소스 검색

refactor: rename code

nian 2 달 전
부모
커밋
9e13751a85
2개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      src/layout/main/index.vue
  2. 1 0
      src/stores/tabs.ts

+ 4 - 0
src/layout/main/index.vue

@@ -11,6 +11,7 @@ import { useTabsStore } from '@/stores/tabs'
 
 import type { Tab } from '@/stores/tabs'
 import type { RouteLocationNormalizedLoaded } from 'vue-router'
+import { csCZ } from 'naive-ui'
 
 defineOptions({
   name: 'MainLayout',
@@ -114,12 +115,15 @@ watch(
 onMounted(() => {
   const currentRoute = router.currentRoute.value
   const { name, meta } = currentRoute
+  console.log(tabs.value)
   const findTab = tabs.value.find((item) => item.name === name)
   const { showTab, multiTab } = meta
 
   if (name === 'layout' && tabActiveKey.value) {
     router.replace(tabActiveKey.value)
   } else if (showTab && (!findTab || multiTab)) {
+    console.log(!findTab, multiTab)
+
     doCreateTab(currentRoute)
   } else if (!isEmpty(findTab)) {
     setActive(findTab.key)

+ 1 - 0
src/stores/tabs.ts

@@ -19,6 +19,7 @@ export const useTabsStore = defineStore('tabsStore', () => {
       componentName: 'Dashboard',
       icon: 'iconify-[mage--dashboard-chart]',
       key: '/dashboard',
+      name: 'dashboard',
       label: '仪表板',
       pinned: true,
     },