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
|
2015-10-28 20:55:49 +08:00
|
|
|
import { Switch, Button } from 'antd';
|
2015-07-13 16:51:56 +08:00
|
|
|
|
2015-10-28 20:55:49 +08:00
|
|
|
const Test = React.createClass({
|
2015-07-13 16:51:56 +08:00
|
|
|
getInitialState() {
|
|
|
|
return {
|
2015-07-20 14:32:21 +08:00
|
|
|
disabled: true
|
2015-11-25 17:35:49 +08:00
|
|
|
};
|
2015-07-13 16:51:56 +08:00
|
|
|
},
|
2016-01-07 16:29:12 +08:00
|
|
|
toggle() {
|
2015-07-13 16:51:56 +08:00
|
|
|
this.setState({
|
|
|
|
disabled: !this.state.disabled
|
|
|
|
});
|
|
|
|
},
|
|
|
|
render() {
|
2016-01-07 16:29:12 +08:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<Switch disabled={this.state.disabled} />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<Button type="primary" onClick={this.toggle}>Toggle disabled</Button>
|
|
|
|
</div>
|
|
|
|
);
|
2015-07-13 16:51:56 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-12-29 12:08:58 +08:00
|
|
|
ReactDOM.render(<Test />, mountNode);
|
2015-07-13 16:51:56 +08:00
|
|
|
````
|