update Dropdown
update Dropdown
This commit is contained in:
parent
745bcbc25e
commit
5557dd66f5
3 changed files with 14 additions and 5 deletions
|
@ -36,16 +36,18 @@
|
|||
},
|
||||
methods: {
|
||||
handleClick () {
|
||||
const $parent = this.$parent.$parent;
|
||||
if (this.disabled) {
|
||||
this.$nextTick(() => {
|
||||
this.$parent.$parent.visible = true;
|
||||
$parent.visible = true;
|
||||
});
|
||||
} else {
|
||||
if (this.$parent.$parent.trigger === 'hover') {
|
||||
this.$parent.$parent.visible = false;
|
||||
if ($parent.trigger === 'hover') {
|
||||
$parent.visible = false;
|
||||
$parent.$emit('on-hover-click');
|
||||
}
|
||||
}
|
||||
this.$parent.$parent.$emit('on-click', this.key);
|
||||
$parent.$emit('on-click', this.key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,6 +87,13 @@
|
|||
if ($parent && $parent.$options.name === 'Dropdown') {
|
||||
$parent.$emit('on-click', key);
|
||||
}
|
||||
},
|
||||
'on-hover-click' () {
|
||||
const $parent = this.$parent.$parent;
|
||||
if ($parent && $parent.$options.name === 'Dropdown') {
|
||||
$parent.visible = false;
|
||||
$parent.$emit('on-hover-click');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<Dropdown trigger="click" @on-click="click" style="margin-left: 20px">
|
||||
<Dropdown trigger="hover" @on-click="click" style="margin-left: 20px">
|
||||
<a href="javascript:void(0)">
|
||||
click 触发
|
||||
<Icon type="arrow-down-b"></Icon>
|
||||
|
|
Loading…
Add table
Reference in a new issue