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

46 lines
789 B
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 1
title:
zh-CN: 不可用
en-US: disabled
2016-03-31 09:40:55 +08:00
---
2015-07-16 18:23:25 +08:00
## zh-CN
2015-07-16 18:23:25 +08:00
Radio 不可用。
## en-US
Radio unavailable.
2017-02-13 10:55:53 +08:00
```jsx
import { Radio, Button } from 'antd';
2015-07-16 18:23:25 +08:00
class App extends React.Component {
state = {
disabled: true,
}
toggleDisabled = () => {
2015-07-16 22:40:49 +08:00
this.setState({
2016-05-11 09:32:33 +08:00
disabled: !this.state.disabled,
2015-07-16 22:40:49 +08:00
});
}
2015-07-16 22:40:49 +08:00
render() {
return (
<div>
<Radio defaultChecked={false} disabled={this.state.disabled}>Disabled</Radio>
<br />
<Radio defaultChecked disabled={this.state.disabled}>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);
```