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

43 lines
822 B
Markdown
Raw Normal View History

2015-07-16 18:23:25 +08:00
# 不可用
- order: 1
Radio 不可用。
---
````jsx
var Radio = antd.Radio;
2015-07-16 22:40:49 +08:00
function toggleDisabled() {
disabled = !disabled;
}
var App = React.createClass({
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-07-17 16:56:40 +08:00
<Radio defaultChecked={true} disabled={this.state.disabled}>不可用</Radio>
2015-07-17 11:55:16 +08:00
<div style={{marginTop: 20}}>
2015-07-16 22:41:27 +08:00
<button className="ant-btn ant-btn-primary" onClick={this.toggleDisabled}>
Toggle disabled
</button>
</div>
2015-07-16 22:40:49 +08:00
</div>;
}
});
React.render(<App />, document.getElementById('components-radio-demo-disable'));
2015-07-16 18:23:25 +08:00
````