瀏覽代碼

fix: 修复强制刷新页面`getTopMenu()`函数获取不到`path`报错的问题

xiaoxian521 1 年之前
父節點
當前提交
b29500c4ed
共有 3 個文件被更改,包括 3 次插入3 次删除
  1. 1 1
      src/layout/components/sidebar/logo.vue
  2. 1 1
      src/layout/components/tag/index.vue
  3. 1 1
      src/layout/hooks/useNav.ts

+ 1 - 1
src/layout/components/sidebar/logo.vue

@@ -7,7 +7,7 @@ const props = defineProps({
 });
 
 const { title } = useNav();
-const topPath = getTopMenu().path;
+const topPath = getTopMenu()?.path;
 </script>
 
 <template>

+ 1 - 1
src/layout/components/tag/index.vue

@@ -50,7 +50,7 @@ const tabDom = ref();
 const containerDom = ref();
 const scrollbarDom = ref();
 const isShowArrow = ref(false);
-const topPath = getTopMenu().path;
+const topPath = getTopMenu()?.path;
 const { VITE_HIDE_HOME } = import.meta.env;
 const { isFullscreen, toggle } = useFullscreen();
 

+ 1 - 1
src/layout/hooks/useNav.ts

@@ -88,7 +88,7 @@ export function useNav() {
   }
 
   function backTopMenu() {
-    router.push(getTopMenu().path);
+    router.push(getTopMenu()?.path);
   }
 
   function onPanel() {