2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 4
|
2016-07-21 10:09:01 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 禁用选项
|
|
|
|
en-US: Disabled option
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2016-01-25 15:31:08 +08:00
|
|
|
|
2016-07-21 10:09:01 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2016-01-25 15:31:08 +08:00
|
|
|
通过指定 options 里的 `disabled` 字段。
|
|
|
|
|
2016-07-21 10:09:01 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
Disable option by specifying the `disabled` property in `options`.
|
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```jsx
|
2016-01-25 15:31:08 +08:00
|
|
|
import { Cascader } from 'antd';
|
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
const options = [
|
|
|
|
{
|
|
|
|
value: 'zhejiang',
|
|
|
|
label: 'Zhejiang',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'hangzhou',
|
|
|
|
label: 'Hangzhou',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'xihu',
|
|
|
|
label: 'West Lake',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'jiangsu',
|
|
|
|
label: 'Jiangsu',
|
|
|
|
disabled: true,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'nanjing',
|
|
|
|
label: 'Nanjing',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'zhonghuamen',
|
|
|
|
label: 'Zhong Hua Men',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
];
|
2016-01-25 15:31:08 +08:00
|
|
|
|
|
|
|
function onChange(value) {
|
|
|
|
console.log(value);
|
|
|
|
}
|
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
ReactDOM.render(<Cascader options={options} onChange={onChange} />, mountNode);
|
|
|
|
```
|