ant-design/components/radio/demo/disable.md

39 lines
758 B
Markdown
Raw Normal View History

2015-07-16 18:23:25 +08:00
# 不可用
- order: 1
Radio 不可用。
---
````jsx
import { Radio, Button } from 'antd';
2015-07-16 18:23:25 +08:00
const App = React.createClass({
2015-07-16 22:40:49 +08:00
getInitialState() {
return {
2015-07-16 22:50:05 +08:00
disabled: true
2015-07-16 22:40:49 +08:00
};
},
toggleDisabled() {
this.setState({
disabled: !this.state.disabled
});
},
render() {
return <div>
2015-07-17 16:56:40 +08:00
<Radio defaultChecked={false} disabled={this.state.disabled}>不可用</Radio>
2015-07-16 22:40:49 +08:00
<br />
2015-11-25 17:47:55 +08:00
<Radio defaultChecked disabled={this.state.disabled}>不可用</Radio>
2015-07-17 11:55:16 +08:00
<div style={{marginTop: 20}}>
<Button type="primary" onClick={this.toggleDisabled}>
2015-07-16 22:41:27 +08:00
Toggle disabled
</Button>
2015-07-16 22:41:27 +08:00
</div>
2015-07-16 22:40:49 +08:00
</div>;
}
});
2015-10-20 16:47:55 +08:00
ReactDOM.render(<App />, document.getElementById('components-radio-demo-disable'));
2015-07-16 18:23:25 +08:00
````