Close menu on leaf click
parent
d8718af3f8
commit
0ae04152c1
|
@ -6,7 +6,7 @@
|
||||||
<div class="p-menubar-start" v-if="$slots.start">
|
<div class="p-menubar-start" v-if="$slots.start">
|
||||||
<slot name="start"></slot>
|
<slot name="start"></slot>
|
||||||
</div>
|
</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">
|
<div class="p-menubar-custom" v-if="$slots.default">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
|
@ -61,6 +61,9 @@ export default {
|
||||||
this.outsideClickListener = null;
|
this.outsideClickListener = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onLeafClick() {
|
||||||
|
this.mobileActive = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
containerClass() {
|
containerClass() {
|
||||||
|
|
|
@ -116,10 +116,7 @@ export default {
|
||||||
},
|
},
|
||||||
onLeafClick() {
|
onLeafClick() {
|
||||||
this.activeItem = null;
|
this.activeItem = null;
|
||||||
|
this.$emit('leaf-click');
|
||||||
if (!this.root) {
|
|
||||||
this.$emit('leaf-click');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onItemKeyDown(event, item) {
|
onItemKeyDown(event, item) {
|
||||||
let listItem = event.currentTarget.parentElement;
|
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)
|
if (this.activeItem && item === this.activeItem)
|
||||||
this.activeItem = null;
|
this.activeItem = null;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue