Skip to content

Commit fd47f14

Browse files
committed
Restored methods
1 parent 45a9dc4 commit fd47f14

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

components/dropdown.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,23 @@
6262
},
6363
methods: {
6464
toggle(e) {
65+
// hide an alert
6566
this.show = !this.show;
67+
// Dispatch an event from the current vm that propagates all the way up to its $root
68+
if (this.show) {
69+
this.$root.$emit('shown::dropdown');
70+
e.stopPropagation()
71+
} else {
72+
this.$root.$emit('hidden::dropdown');
73+
}
6674
}
6775
},
76+
created: function () {
77+
const hub = this.$root;
78+
hub.$on('hide::dropdown', function () {
79+
this.show = false
80+
});
81+
},
6882
}
69-
</script>
83+
84+
</script>

0 commit comments

Comments
 (0)