|
|
|
---
|
|
|
|
order: 11
|
|
|
|
debug: true
|
|
|
|
title:
|
|
|
|
zh-CN: 自定义图标
|
|
|
|
en-US: Custom Icons
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
通过 `suffixIcon` 自定义选择框后缀图标,通过 `expandIcon` 自定义次级菜单展开图标。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Use `suffixIcon` to customize the selection box suffix icon, and use `expandIcon` to customize the current item expand icon.
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
import { Cascader } from 'antd';
|
|
|
|
import { SmileOutlined } from '@ant-design/icons';
|
|
|
|
|
|
|
|
const options = [
|
|
|
|
{
|
|
|
|
value: 'zhejiang',
|
|
|
|
label: 'Zhejiang',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'hangzhou',
|
|
|
|
label: 'Hangzhou',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'xihu',
|
|
|
|
label: 'West Lake',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'jiangsu',
|
|
|
|
label: 'Jiangsu',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'nanjing',
|
|
|
|
label: 'Nanjing',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
value: 'zhonghuamen',
|
|
|
|
label: 'Zhong Hua Men',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
function onChange(value) {
|
|
|
|
console.log(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
<>
|
|
|
|
<Cascader
|
|
|
|
suffixIcon={<SmileOutlined />}
|
|
|
|
options={options}
|
|
|
|
onChange={onChange}
|
|
|
|
placeholder="Please select"
|
|
|
|
/>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<Cascader suffixIcon="ab" options={options} onChange={onChange} placeholder="Please select" />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<Cascader
|
|
|
|
expandIcon={<SmileOutlined />}
|
|
|
|
options={options}
|
|
|
|
onChange={onChange}
|
|
|
|
placeholder="Please select"
|
|
|
|
/>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<Cascader expandIcon="ab" options={options} onChange={onChange} placeholder="Please select" />
|
|
|
|
</>,
|
|
|
|
mountNode,
|
|
|
|
);
|
|
|
|
```
|