Hide TieredMenu when a leaf is clicked

pull/132/head
cagataycivici 2019-12-04 16:59:33 +03:00
parent 9ca8437f0a
commit 64a9aa36e6
2 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,7 @@
<template>
<transition name="p-input-overlay" @enter="onEnter" @leave="onLeave">
<div ref="container" :class="containerClass" v-if="popup ? visible : true">
<TieredMenuSub :model="model" :root="true" :popup="popup" />
<TieredMenuSub :model="model" :root="true" :popup="popup" @leaf-click="onLeafClick"/>
</div>
</transition>
</template>
@ -136,6 +136,11 @@ export default {
else
document.getElementById(this.appendTo).removeChild(this.$refs.container);
}
},
onLeafClick() {
if (this.popup) {
this.hide();
}
}
},
computed: {

View File

@ -112,10 +112,7 @@ export default {
},
onLeafClick() {
this.activeItem = null;
if (!this.root) {
this.$emit('leaf-click');
}
this.$emit('leaf-click');
},
onItemKeyDown(event, item) {
let listItem = event.currentTarget.parentElement;