This commit is contained in:
2019-04-16 23:29:17 +00:00
parent ccb56817e5
commit 0a835c2d0b
2 changed files with 39 additions and 24 deletions

View File

@@ -57,13 +57,12 @@
</template>
</v-list>-->
<!-- MAIN MENU -->
<v-list v-if="appBar.isMain">
<v-list v-if="appBar.isMain">
<v-list-tile
v-for="item in appBar.mainMenuItems"
:key="item.key"
@click="$gzevent.$emit('main-menu-click',item.key)"
@click="$gzevent.$emit('menu-click',item.key)"
>
<v-divider v-if="item.divider" :key="index" :inset="item.inset"></v-divider>
<v-list-tile-action>
<v-icon v-if="item.icon">{{ "fa-" + item.icon }}</v-icon>
</v-list-tile-action>
@@ -75,11 +74,10 @@
<!-- CONTEXT MENU -->
<v-list v-if="!appBar.isMain">
<v-list-tile
v-for="item in appBar.contextItems"
v-for="item in appBar.contextMenuItems"
:key="item.key"
@click="$gzevent.$emit('context-menu-click',item.key)"
@click="$gzevent.$emit('menu-click',item.key)"
>
<v-list-tile-action>
<v-icon v-if="item.icon">{{ "fa-" + item.icon }}</v-icon>
</v-list-tile-action>
@@ -124,12 +122,8 @@ export default {
isMain: true,
icon: "",
title: "",
contextItems: [],
mainMenuItems: [
{ title: "Log off", icon: "sign-out-alt", key: "app:logout" },
{ title: "Help", key: "app:help" },
{ divider: true }
]
contextMenuItems: [],
mainMenuItems: []
},
items: [
{ header: "Today" },
@@ -157,17 +151,36 @@ export default {
};
},
created() {
//subscribe to context menu changes
//subscribe to menu changes
var that = this;
this.$gzevent.$on("menu-change", function(ctx) {
that.appBar.isMain = ctx.isMain;
that.appBar.icon = ctx.icon;
that.appBar.title = ctx.title;
that.appBar.contextItems = ctx.contextItems ? ctx.contextItems : [];
if (!ctx.isMain) {
//context menu so handle accordingly
that.appBar.contextMenuItems = ctx.contextMenuItems
? ctx.contextMenuItems
: [];
} else {
//main menu, put in the standard items that always show
that.appBar.mainMenuItems = [
{ title: "Log off", icon: "sign-out-alt", key: "app:logout" },
{ title: "Help", key: "app:help" }
];
//If other items specified add them above the standard ones
if (ctx.mainMenuItems) {
that.appBar.mainMenuItems = ctx.mainMenuItems.concat(
that.appBar.mainMenuItems
);
}
}
});
this.$gzevent.$on("main-menu-click", function(key) {
alert("App.vue::main-menu click: " + key);
this.$gzevent.$on("menu-click", function(key) {
if (key.startsWith("app:")) {
alert("App.vue::menu click: " + key);
}
});
},
beforeDestroy() {