ant-design-vue/components/cascader/demo/hover.md

72 lines
1.4 KiB
Markdown
Raw Normal View History

2018-03-04 08:02:46 +00:00
<cn>
#### 移入展开
通过移入展开下级菜单,点击完成选择。
</cn>
<us>
#### Hover
Hover to expand sub menu, click to select option.
</us>
```html
<template>
2019-09-28 12:45:07 +00:00
<a-cascader
:options="options"
:displayRender="displayRender"
expandTrigger="hover"
@change="onChange"
placeholder="Please select"
/>
2018-03-04 08:02:46 +00:00
</template>
<script>
2019-09-28 12:45:07 +00:00
export default {
data() {
return {
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',
},
],
},
],
},
],
};
},
methods: {
onChange(value) {
console.log(value);
},
displayRender({ labels }) {
return labels[labels.length - 1];
},
2018-03-04 08:02:46 +00:00
},
2019-09-28 12:45:07 +00:00
};
2018-03-04 08:02:46 +00:00
</script>
```