fix: menus title

This commit is contained in:
Fine 2023-07-22 13:26:57 +08:00
parent 3bdd1d1c67
commit 52ee7c6f45

View File

@ -36,14 +36,16 @@ limitations under the License. -->
<Icon size="lg" :iconName="menu.meta.icon" /> <Icon size="lg" :iconName="menu.meta.icon" />
</el-icon> </el-icon>
<span class="title" :class="isCollapse ? 'collapse' : ''"> <span class="title" :class="isCollapse ? 'collapse' : ''">
{{ t(menu.meta.i18nKey) }} {{ te(menu.meta.i18nKey) ? t(menu.meta.i18nKey) : menu.meta.title }}
</span> </span>
</router-link> </router-link>
</template> </template>
<el-menu-item-group> <el-menu-item-group>
<el-menu-item v-for="(m, idx) in filterMenus(menu.children)" :index="m.name" :key="idx"> <el-menu-item v-for="(m, idx) in filterMenus(menu.children)" :index="m.name" :key="idx">
<router-link class="items" :to="m.path"> <router-link class="items" :to="m.path">
<span class="title">{{ t(m.meta && m.meta.i18nKey) }}</span> <span class="title">
{{ m.meta && (te(menu.meta.i18nKey) ? t(menu.meta.i18nKey) : menu.meta.title) }}
</span>
</router-link> </router-link>
</el-menu-item> </el-menu-item>
</el-menu-item-group> </el-menu-item-group>
@ -56,7 +58,9 @@ limitations under the License. -->
</el-icon> </el-icon>
<template #title> <template #title>
<router-link class="items menu-title" :to="menu.children[0].path"> <router-link class="items menu-title" :to="menu.children[0].path">
<span class="title">{{ t(menu.meta.i18nKey) }}</span> <span class="title">
{{ te(menu.meta.i18nKey) ? t(menu.meta.i18nKey) : menu.meta.title }}
</span>
</router-link> </router-link>
</template> </template>
</el-menu-item> </el-menu-item>
@ -75,7 +79,7 @@ limitations under the License. -->
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
/*global Recordable*/ /*global Recordable*/
const { t } = useI18n(); const { t, te } = useI18n();
const appStore = useAppStoreWithOut(); const appStore = useAppStoreWithOut();
const router = useRouter(); const router = useRouter();
const name = ref<string>(String(router.currentRoute.value.name)); const name = ref<string>(String(router.currentRoute.value.name));
@ -87,7 +91,7 @@ limitations under the License. -->
const isCollapse = ref(true); const isCollapse = ref(true);
const showMenu = ref(true); const showMenu = ref(true);
const open = ref<boolean>(false); const open = ref<boolean>(false);
console.log(routes.value);
if (/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) { if (/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) {
appStore.setIsMobile(true); appStore.setIsMobile(true);
} else { } else {