|
@@ -32,7 +32,7 @@
|
|
|
|
|
|
<script setup lang="ts" name="navMenuVertical">
|
|
|
import { defineAsyncComponent, reactive, computed, onMounted, watch } from 'vue';
|
|
|
-import { useRoute, onBeforeRouteUpdate, RouteRecordRaw } from 'vue-router';
|
|
|
+import { useRoute, onBeforeRouteUpdate, RouteRecordRaw, useRouter } from 'vue-router';
|
|
|
import { storeToRefs } from 'pinia';
|
|
|
import { useThemeConfig } from '@/stores/themeConfig';
|
|
|
import { verifyUrl } from '@/utils/toolsValidate';
|
|
@@ -53,9 +53,10 @@ const props = defineProps({
|
|
|
const storesThemeConfig = useThemeConfig();
|
|
|
const { themeConfig } = storeToRefs(storesThemeConfig);
|
|
|
const route = useRoute();
|
|
|
+const router = useRouter();
|
|
|
const state = reactive({
|
|
|
// 修复:https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
|
|
|
- defaultActive: route.meta.isDynamic ? route.meta.isDynamicPath : route.path,
|
|
|
+ defaultActive: route.meta?.isDynamic ? route.meta?.isDynamicPath : route.path,
|
|
|
isCollapse: false,
|
|
|
});
|
|
|
|
|
@@ -78,8 +79,8 @@ const setParentHighlight = (currentRoute: RouteToFrom) => {
|
|
|
const onALinkClick = (val: RouteItem) => {
|
|
|
const { origin, pathname } = window.location;
|
|
|
router.push(val.path);
|
|
|
- if (verifyUrl(val.meta.isLink)) window.open(val.meta.isLink);
|
|
|
- else window.open(`${origin}${pathname}#${val.meta.isLink}`);
|
|
|
+ if (verifyUrl(<string>val.meta?.isLink)) window.open(val.meta?.isLink);
|
|
|
+ else window.open(`${origin}${pathname}#${val.meta?.isLink}`);
|
|
|
};
|
|
|
// 页面加载时
|
|
|
onMounted(() => {
|