Commit 5557dd66f52516088e8b3e19f1678691f610bb6a
1 parent
745bcbc2
update Dropdown
update Dropdown
Showing
3 changed files
with
14 additions
and
5 deletions
Show diff stats
src/components/dropdown/dropdown-item.vue
... | ... | @@ -36,16 +36,18 @@ |
36 | 36 | }, |
37 | 37 | methods: { |
38 | 38 | handleClick () { |
39 | + const $parent = this.$parent.$parent; | |
39 | 40 | if (this.disabled) { |
40 | 41 | this.$nextTick(() => { |
41 | - this.$parent.$parent.visible = true; | |
42 | + $parent.visible = true; | |
42 | 43 | }); |
43 | 44 | } else { |
44 | - if (this.$parent.$parent.trigger === 'hover') { | |
45 | - this.$parent.$parent.visible = false; | |
45 | + if ($parent.trigger === 'hover') { | |
46 | + $parent.visible = false; | |
47 | + $parent.$emit('on-hover-click'); | |
46 | 48 | } |
47 | 49 | } |
48 | - this.$parent.$parent.$emit('on-click', this.key); | |
50 | + $parent.$emit('on-click', this.key); | |
49 | 51 | } |
50 | 52 | } |
51 | 53 | } | ... | ... |
src/components/dropdown/dropdown.vue
... | ... | @@ -87,6 +87,13 @@ |
87 | 87 | if ($parent && $parent.$options.name === 'Dropdown') { |
88 | 88 | $parent.$emit('on-click', key); |
89 | 89 | } |
90 | + }, | |
91 | + 'on-hover-click' () { | |
92 | + const $parent = this.$parent.$parent; | |
93 | + if ($parent && $parent.$options.name === 'Dropdown') { | |
94 | + $parent.visible = false; | |
95 | + $parent.$emit('on-hover-click'); | |
96 | + } | |
90 | 97 | } |
91 | 98 | } |
92 | 99 | } | ... | ... |
test/routers/dropdown.vue