Add Button propsType

This commit is contained in:
afc163 2015-10-28 15:45:31 +08:00
parent b52cb83295
commit 7c9892a9c7
2 changed files with 14 additions and 3 deletions

View File

@ -57,6 +57,17 @@ export default class Button extends React.Component {
</button>;
}
}
Button.propTypes = {
type: React.PropTypes.string,
shape: React.PropTypes.string,
size: React.PropTypes.string,
htmlType: React.PropTypes.string,
onClick: React.PropTypes.func,
loading: React.PropTypes.bool,
className: React.PropTypes.string,
};
Button.defaultProps = {
onClick() {},
};

View File

@ -22,13 +22,13 @@ var App = React.createClass({
},
render() {
return <div>
<Button type="primary" size="large" loading>
<Button type="primary" size="large" loading={true}>
加载中
</Button>
<Button type="primary" loading="true">
<Button type="primary" loading={true}>
加载中
</Button>
<Button type="primary" size="small" loading>
<Button type="primary" size="small" loading={true}>
加载中
</Button>
<br />