diff --git a/src/layout/components/Sidebar/LeftMenu.vue b/src/layout/components/Sidebar/LeftMenu.vue index bae939cf..16d13282 100644 --- a/src/layout/components/Sidebar/LeftMenu.vue +++ b/src/layout/components/Sidebar/LeftMenu.vue @@ -5,6 +5,9 @@ import { useSettingsStore } from "@/store/modules/settings"; import { useAppStore } from "@/store/modules/app"; import variables from "@/styles/variables.module.scss"; +import path from "path-browserify"; +import { isExternal } from "@/utils/index"; + const settingsStore = useSettingsStore(); const appStore = useAppStore(); const currRoute = useRoute(); @@ -17,7 +20,29 @@ const props = defineProps({ }, type: Array, }, + basePath: { + type: String, + required: true, + }, }); + +/** + * 解析路径 + * + * @param routePath 路由路径 + */ +function resolvePath(routePath: string) { + if (isExternal(routePath)) { + return routePath; + } + if (isExternal(props.basePath)) { + return props.basePath; + } + + // 完整路径 = 父级路径(/level/level_3) + 路由路径 + const fullPath = path.resolve(props.basePath, routePath); // 相对路径 → 绝对路径 + return fullPath; +}