|
|
@@ -1,6 +1,7 @@
|
|
|
<!-- layout/index.vue -->
|
|
|
<template>
|
|
|
<div
|
|
|
+ v-if="layoutReady"
|
|
|
class="app-wrapper"
|
|
|
:style="{
|
|
|
'--current-color': theme,
|
|
|
@@ -53,6 +54,9 @@ const HOME_PATH = "/index";
|
|
|
// 默认业务入口(工程基本信息 - 内部首页)
|
|
|
const DEFAULT_BIZ_PATH = "/proj/index";
|
|
|
|
|
|
+// 布局就绪状态 — 权限路由加载完成后才渲染,避免闪烁
|
|
|
+const layoutReady = ref(false);
|
|
|
+
|
|
|
// 计算属性
|
|
|
const theme = computed(() => settingsStore.theme);
|
|
|
const sidebar = computed(() => appStore.sidebar);
|
|
|
@@ -156,10 +160,21 @@ watch(
|
|
|
onMounted(() => {
|
|
|
// 如果当前是根路径或首页,跳转到工程基本信息-堤防管理(默认页面)
|
|
|
if (route.path === "/" || route.path === HOME_PATH) {
|
|
|
- router.push(DEFAULT_BIZ_PATH);
|
|
|
+ router.replace(DEFAULT_BIZ_PATH);
|
|
|
}
|
|
|
activeTopMenu.value = getCurrentTopMenu();
|
|
|
});
|
|
|
+
|
|
|
+// 权限路由加载完成后才渲染布局,避免异步加载期间 Layout 空壳闪烁
|
|
|
+watch(
|
|
|
+ () => permissionStore.routes,
|
|
|
+ (routes) => {
|
|
|
+ if (routes && routes.length > 0) {
|
|
|
+ layoutReady.value = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { immediate: true },
|
|
|
+);
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|