ant-design/components/cascader/demo/search.md

57 lines
792 B
Markdown
Raw Normal View History

---
order: 9
title:
zh-CN: 搜索
en-US: Search
---
## zh-CN
可以直接搜索选项并选择。
## en-US
Search and select options directly.
````jsx
import { Cascader } from 'antd';
const options = [{
value: 'zhejiang',
2016-09-10 18:23:24 +08:00
label: 'Zhejiang',
children: [{
value: 'hangzhou',
2016-09-10 18:23:24 +08:00
label: 'Hangzhou',
children: [{
value: 'xihu',
2016-09-10 18:23:24 +08:00
label: 'West Lake',
}],
}],
}, {
value: 'jiangsu',
2016-09-10 18:23:24 +08:00
label: 'Jiangsu',
children: [{
value: 'nanjing',
2016-09-10 18:23:24 +08:00
label: 'Nanjing',
children: [{
value: 'zhonghuamen',
2016-09-10 18:23:24 +08:00
label: 'Zhong Hua men',
}],
}],
}];
function onChange(value) {
console.log(value);
}
ReactDOM.render(
2016-09-13 11:51:34 +08:00
<Cascader
options={options}
onChange={onChange}
placeholder="Please select"
showSearch
/>,
mountNode
);
````