ant-design/components/switch/demo/disabled.md

36 lines
607 B
Markdown
Raw Normal View History

2015-07-20 14:32:21 +08:00
# 不可用
2015-07-13 16:51:56 +08:00
- order: 1
2015-07-20 14:32:21 +08:00
Switch 失效状态。
2015-07-13 16:51:56 +08:00
---
````jsx
var Switch = antd.Switch;
var container = document.getElementById('components-switch-demo-disabled');
var Test = React.createClass({
getInitialState() {
return {
2015-07-20 14:32:21 +08:00
disabled: true
2015-07-13 16:51:56 +08:00
}
},
toggle(){
this.setState({
disabled: !this.state.disabled
});
},
render() {
return <div>
<Switch disabled={this.state.disabled} />
<br />
<br />
2015-07-15 20:54:37 +08:00
<button className="ant-btn ant-btn-primary" onClick={this.toggle}>Toggle disabled</button>
2015-07-13 16:51:56 +08:00
</div>;
}
});
React.render(<Test />, container);
````