Close menu on leaf click

pull/345/head
cagataycivici 2020-05-15 18:31:05 +03:00
parent d8718af3f8
commit 0ae04152c1
3 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,7 @@
<div class="p-menubar-start" v-if="$slots.start">
<slot name="start"></slot>
</div>
<MenubarSub ref="rootmenu" :model="model" :root="true" :mobileActive="mobileActive"/>
<MenubarSub ref="rootmenu" :model="model" :root="true" :mobileActive="mobileActive" @leaf-click="onLeafClick"/>
<div class="p-menubar-custom" v-if="$slots.default">
<slot></slot>
</div>
@ -61,6 +61,9 @@ export default {
this.outsideClickListener = null;
}
},
onLeafClick() {
this.mobileActive = false;
}
},
computed: {
containerClass() {

View File

@ -116,10 +116,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;

View File

@ -99,7 +99,7 @@ export default {
});
}
if (this.root && item.items) {
if (item.items) {
if (this.activeItem && item === this.activeItem)
this.activeItem = null;
else