Permalink
Browse files

feat(dropdowns): Add hide() and show() methods (#1012)

Addresses issue #1011
  • Loading branch information...
tmorehouse committed Sep 8, 2017
1 parent 9fae398 commit a2a9bc4cec1ece3ae768dce3f94421186b0115c1
Showing with 21 additions and 1 deletion.
  1. +21 −1 lib/mixins/dropdown.js
@@ -117,6 +117,12 @@ export default {
} else {
this.hideMenu();
}
},
disabled(state, old) {
if (state !== old && state && this.visible) {
// Hide dropdown if disabled changes to true
this.visible = false;
}
}
},
computed: {
@@ -239,13 +245,27 @@ export default {
this.$emit("click", e);
},
toggle() {
// Called only by a button that toggles teh menu
// Called only by a button that toggles the menu
if (this.disabled) {
this.visible = false;
return;
}
this.visible = !this.visible;
},
show() {
// Public method to show dropdown
if (this.disabled) {
return;
}
this.visible = true;
},
hide() {
// Public method to hide dropdown
if (this.disabled) {
return;
}
this.visible = false;
},
onTab() {
if (this.visible) {
// TODO: Need special handler for dealing with form inputs

0 comments on commit a2a9bc4

Please sign in to comment.