Refactoring

This commit is contained in:
syuilo 2020-12-26 15:38:51 +09:00
parent c5bdee086d
commit 94598ab555
3 changed files with 3 additions and 3 deletions

View file

@ -65,7 +65,7 @@ export default defineComponent({
created() { created() {
this.items = Object.keys(this.menuDef).filter(k => !this.menu.includes(k)).map(k => this.menuDef[k]).filter(def => def.show == null ? true : def.show).map(def => ({ this.items = Object.keys(this.menuDef).filter(k => !this.menu.includes(k)).map(k => this.menuDef[k]).filter(def => def.show == null ? true : def.show).map(def => ({
type: def.to ? 'link' : 'button', type: def.to ? 'link' : 'button',
text: this.$t(def.title), text: this.$ts[def.title],
icon: def.icon, icon: def.icon,
to: def.to, to: def.to,
action: def.action, action: def.action,

View file

@ -20,7 +20,7 @@
<template v-for="item in menu"> <template v-for="item in menu">
<div v-if="item === '-'" class="divider"></div> <div v-if="item === '-'" class="divider"></div>
<component v-else-if="menuDef[item] && (menuDef[item].show !== false)" :is="menuDef[item].to ? 'MkA' : 'button'" class="item _button" :class="item" active-class="active" v-on="menuDef[item].action ? { click: menuDef[item].action } : {}" :to="menuDef[item].to"> <component v-else-if="menuDef[item] && (menuDef[item].show !== false)" :is="menuDef[item].to ? 'MkA' : 'button'" class="item _button" :class="item" active-class="active" v-on="menuDef[item].action ? { click: menuDef[item].action } : {}" :to="menuDef[item].to">
<Fa :icon="menuDef[item].icon" fixed-width/><span class="text">{{ $t(menuDef[item].title) }}</span> <Fa :icon="menuDef[item].icon" fixed-width/><span class="text">{{ $ts[menuDef[item].title] }}</span>
<i v-if="menuDef[item].indicated"><Fa :icon="faCircle"/></i> <i v-if="menuDef[item].indicated"><Fa :icon="faCircle"/></i>
</component> </component>
</template> </template>

View file

@ -76,7 +76,7 @@ export default defineComponent({
title: this.$ts.addItem, title: this.$ts.addItem,
select: { select: {
items: [...menu.map(k => ({ items: [...menu.map(k => ({
value: k, text: this.$t(this.menuDef[k].title) value: k, text: this.$ts[this.menuDef[k].title]
})), ...[{ })), ...[{
value: '-', text: this.$ts.divider value: '-', text: this.$ts.divider
}]] }]]