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: {
|
methods: {
|
||||||
handleClick () {
|
handleClick () {
|
||||||
|
const $parent = this.$parent.$parent;
|
||||||
if (this.disabled) {
|
if (this.disabled) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$parent.$parent.visible = true;
|
$parent.visible = true;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (this.$parent.$parent.trigger === 'hover') {
|
if ($parent.trigger === 'hover') {
|
||||||
this.$parent.$parent.visible = false;
|
$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') {
|
if ($parent && $parent.$options.name === 'Dropdown') {
|
||||||
$parent.$emit('on-click', key);
|
$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>
|
<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)">
|
<a href="javascript:void(0)">
|
||||||
click 触发
|
click 触发
|
||||||
<Icon type="arrow-down-b"></Icon>
|
<Icon type="arrow-down-b"></Icon>
|
||||||
|
|
Loading…
Add table
Reference in a new issue