Browse Source

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

xiaoxian521 1 year ago
parent
commit
b29500c4ed

+ 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() {