Handy_Cao 7 місяців тому
батько
коміт
c9b1898304

+ 1 - 1
src/packages/pc/components/layouts/header/index.vue

@@ -6,7 +6,7 @@
                 <template v-for="(item, index) in $route.matched" :key="index">
                     <el-breadcrumb-item>
                         <!--<i :class="item.meta.icon" v-if="item.meta.icon"></i>-->
-                        <span>{{ item.meta.title ?? 'item.name' }}</span>
+                        <span>{{ t('routes.'+(item.name ?? item.meta.name)) }}</span>
                     </el-breadcrumb-item>
                 </template>
             </el-breadcrumb>

+ 4 - 2
src/packages/pc/components/layouts/navbar/index.vue

@@ -8,7 +8,7 @@
                 <template v-for="(item, index) in state.historyStacks" :key="index">
                     <li :class="['app-navbar__tab-item', activeName === item.name && 'is-active']"
                         @click="changeTab(index)">
-                        <span class="text">{{ item.title }}</span>
+                        <span class="text">{{ t('routes.'+item.name) }}</span>
                         <span class="icon"
                             v-if="state.historyStacks.length > 1 && (isMobile ? activeName === item.name : true)">
                             <i class="g-icon--close" @click.stop="removeTab(index)"></i>
@@ -26,7 +26,7 @@
 <script lang="ts" setup>
 import { computed, ref, watch } from 'vue'
 import { useRoute, useRouter } from 'vue-router'
-import { useGlobalStore } from '@/stores'
+import { useGlobalStore, i18n } from '@/stores'
 import historyRouter from '../../../router/historyRouter'
 
 const { state, removeHistory } = historyRouter;
@@ -44,6 +44,8 @@ const isMobile = computed(() => {
     return globalStore.isMobile;
 })
 
+const  { global: { t } } = i18n
+
 // 选择标签
 const changeTab = (index: number) => {
     const item = state.historyStacks[index];