1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* 钟是志
* 2019年1月10日
* 一个Button
*/
import React, { Component, Fragment } from 'react';
import { Button, Icon } from 'antd';
import styles from './index.less';
import PropTypes from 'prop-types';
export default class ButtonDiy extends Component {
render() {
const {
handleClick,
icon,
name,
className,
type,
htmlType,
loading,
disabled,
size,
style,
boxStyle,
} = this.props;
return (
<span className={styles.ButtonDiy} style={{ ...boxStyle }}>
<Button
onClick={() => {
handleClick();
}}
loading={loading}
className={styles[className]}
style={{ ...style }}
type={type}
disabled={disabled}
htmlType={htmlType}
>
{icon ? <Icon type={icon} /> : null}
{name}
</Button>
</span>
);
}
}
ButtonDiy.propTypes = {
name: PropTypes.string,
icon: PropTypes.string, // icon
handleClick: PropTypes.func, // click函数
className: PropTypes.string, // classname
type: PropTypes.string, // Button type
htmlType: PropTypes.string,
disabled: PropTypes.bool,
loading: PropTypes.bool, //
};
ButtonDiy.defaultProps = {
icon: '', //'plus'
name: '新建子部门',
disabled: false,
type: 'primary',
htmlType: 'button',
loading: false,
className: '', // primaryBlue = {背景色,边框:蓝色 字体:白色} defaultBlue= {背景色:白色 字体,边框:蓝色} defaultRed = {背景色:白色 字体,边框:红色}
handleClick: () => {},
};