This commit is contained in:
2019-04-17 21:50:05 +00:00
parent 1ff1c8d0ea
commit 6bbbc8956c
2 changed files with 37 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
<template> <template>
<v-app id="inspire"> <v-app id="AYANOVA">
<v-navigation-drawer v-if="isAuthenticated" fixed v-model="drawer" app> <v-navigation-drawer v-if="isAuthenticated" fixed v-model="drawer" app>
<v-list dense> <v-list dense>
<v-list-tile v-for="item in navItems" :key="item.route" :to="item.route"> <v-list-tile v-for="item in navItems" :key="item.route" :to="item.route">
@@ -64,12 +64,17 @@
<v-divider v-else-if="item.divider" :key="index" :inset="item.inset"></v-divider> <v-divider v-else-if="item.divider" :key="index" :inset="item.inset"></v-divider>
<v-list-tile v-else :key="item.key" :disabled="item.disabled" @click="$gzevent.$emit('menu-click',item)"> <v-list-tile
v-else
:key="item.key"
:disabled="item.disabled"
@click="$gzevent.$emit('menu-click',item)"
>
<v-list-tile-action> <v-list-tile-action>
<v-icon v-if="item.icon" :color="item.color?item.color:''">{{ "fa-" + item.icon }}</v-icon> <v-icon v-if="item.icon" :color="item.color?item.color:''">{{ "fa-" + item.icon }}</v-icon>
</v-list-tile-action> </v-list-tile-action>
<v-list-tile-content> <v-list-tile-content>
<v-list-tile-title > <v-list-tile-title>
<span>{{ item.title }}</span> <span>{{ item.title }}</span>
</v-list-tile-title> </v-list-tile-title>
</v-list-tile-content> </v-list-tile-content>
@@ -164,6 +169,27 @@ export default {
}); });
}); //END OF EVENT }); //END OF EVENT
//////////////////////////////////
// REPLACE KEY EVENT HANDLER
//
// (used to update a key in place more efficiently)
//
this.$gzevent.$on("menu-replace-item", function(newItem) {
if (!that.appBar.menuItems || !newItem) {
return;
}
//Find the key that is in the collection and replace it
for (var i = 0; i < that.appBar.menuItems.length; i++) {
if (that.appBar.menuItems[i].key == newItem.key) {
//NOTE: since we are adding a new object, it has no reactivity in it so we need to use the Vue.Set to set it which
//automatically adds the setters and getters that trigger reactivity
//If it was set directly on the array it wouldn't update the UI
that.$set(that.appBar.menuItems, i, newItem);
return;
}
}
}); //END OF EVENT
////////////////////////////////// //////////////////////////////////
//CLICK EVENT HANDLER //CLICK EVENT HANDLER
// //

View File

@@ -189,8 +189,6 @@ export default {
{ {
title: this.$gzlocale.get("Save"), title: this.$gzlocale.get("Save"),
icon: "save", icon: "save",
color: "error",
disabled: true,
key: "save" key: "save"
}, },
{ {
@@ -275,7 +273,14 @@ export default {
alert("STUB: DELETE"); alert("STUB: DELETE");
}, //end of remove() }, //end of remove()
stubTestClick() { stubTestClick() {
alert("stub test click"); this.$gzevent.$emit("menu-replace-item", {
title: this.$gzlocale.get("Save"),
icon: "save",
color: "error",
disabled: true,
key: "save"
});
// alert("stub test click");
} }
} }
}; };