mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 02:59:04 +08:00
Allow finish selection on Cascader parent option, close #896
This commit is contained in:
parent
d064e122b3
commit
0c7feaaa1f
43
components/cascader/demo/change-on-select.md
Normal file
43
components/cascader/demo/change-on-select.md
Normal file
@ -0,0 +1,43 @@
|
||||
# 选择即改变
|
||||
|
||||
- order: 5
|
||||
|
||||
这种交互允许只选中父级选项。
|
||||
|
||||
---
|
||||
|
||||
````jsx
|
||||
import { Cascader } from 'antd';
|
||||
|
||||
const options = [{
|
||||
value: 'zhejiang',
|
||||
label: '浙江',
|
||||
children: [{
|
||||
value: 'hangzhou',
|
||||
label: '杭州',
|
||||
children: [{
|
||||
value: 'xihu',
|
||||
label: '西湖',
|
||||
}],
|
||||
}],
|
||||
}, {
|
||||
value: 'jiangsu',
|
||||
label: '江苏',
|
||||
children: [{
|
||||
value: 'nanjing',
|
||||
label: '南京',
|
||||
children: [{
|
||||
value: 'zhonghuamen',
|
||||
label: '中华门',
|
||||
}],
|
||||
}],
|
||||
}];
|
||||
|
||||
function onChange(value) {
|
||||
console.log(value);
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Cascader options={options} onChange={onChange} changeOnSelect />
|
||||
, mountNode);
|
||||
````
|
@ -40,7 +40,7 @@
|
||||
"object-assign": "~4.0.1",
|
||||
"rc-animate": "~2.0.2",
|
||||
"rc-calendar": "~5.3.0",
|
||||
"rc-cascader": "~0.7.0",
|
||||
"rc-cascader": "~0.8.0",
|
||||
"rc-checkbox": "~1.2.0",
|
||||
"rc-collapse": "~1.4.4",
|
||||
"rc-dialog": "~5.3.1",
|
||||
|
Loading…
Reference in New Issue
Block a user