We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 45a9dc4 commit fd47f14Copy full SHA for fd47f14
components/dropdown.vue
@@ -62,8 +62,23 @@
62
},
63
methods: {
64
toggle(e) {
65
+ // hide an alert
66
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
+ }
74
}
75
76
+ created: function () {
77
+ const hub = this.$root;
78
+ hub.$on('hide::dropdown', function () {
79
+ this.show = false
80
+ });
81
+ },
82
-</script>
83
+
84
+</script>
0 commit comments