Close menu on leaf click
parent
d8718af3f8
commit
0ae04152c1
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -99,7 +99,7 @@ export default {
|
|||
});
|
||||
}
|
||||
|
||||
if (this.root && item.items) {
|
||||
if (item.items) {
|
||||
if (this.activeItem && item === this.activeItem)
|
||||
this.activeItem = null;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue