This commit is contained in:
梁灏 2017-10-23 23:08:40 +08:00
parent 6c634aa631
commit a5f4a1d458
2 changed files with 4 additions and 17 deletions

View file

@ -1,6 +1,6 @@
<template>
<div style="width: 200px;margin: 100px;">
<Cascader :data="data" v-model="value1"></Cascader>
<Cascader :data="data" v-model="value1" trigger="hover"></Cascader>
</div>
</template>
<script>
@ -11,20 +11,7 @@
data: [{
value: 'beijing',
label: '北京',
children: [
{
value: 'gugong',
label: '故宫'
},
{
value: 'tiantan',
label: '天坛'
},
{
value: 'wangfujing',
label: '王府井'
}
]
children: []
}, {
value: 'jiangsu',
label: '江苏',

View file

@ -49,11 +49,11 @@
},
methods: {
handleClickItem (item) {
if (this.trigger !== 'click' && item.children) return;
if (this.trigger !== 'click' && item.children && item.children.length) return; // #1922
this.handleTriggerItem(item, false, true);
},
handleHoverItem (item) {
if (this.trigger !== 'hover' || !item.children) return;
if (this.trigger !== 'hover' || !item.children || !item.children.length) return; // #1922
this.handleTriggerItem(item, false, true);
},
handleTriggerItem (item, fromInit = false, fromUser = false) {