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

41 lines
745 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>
<Radio defaultChecked={false} disabled={this.state.disabled}>不可用</Radio>
<br />
<Radio defaultChecked disabled={this.state.disabled}>不可用</Radio>
<div style={{ marginTop: 20 }}>
<Button type="primary" onClick={this.toggleDisabled}>
Toggle disabled
</Button>
</div>
2015-07-16 22:41:27 +08:00
</div>
);
2015-07-16 22:40:49 +08:00
}
});
ReactDOM.render(<App />, mountNode);
2015-07-16 18:23:25 +08:00
````