首页变动

This commit is contained in:
lai
2024-10-24 11:09:33 +08:00
parent fbdd04b4dd
commit 18c2a2e4dc
2 changed files with 38 additions and 19 deletions

View File

@@ -15,7 +15,7 @@ import useRouterStore from '@/store/modules/router';
const routerStore = useRouterStore();
const currentComponent = shallowRef<Component | null>(null);
const spinning = ref<boolean>(true);
const spinning = ref<boolean>(false);
/**匹配views里面所有的.vue或.tsx文件 */
const views = import.meta.glob('../views/**/*.{vue,tsx}') as Record<
@@ -52,20 +52,23 @@ onMounted(() => {
} else {
useLayoutStore().changeConf('layout', 'mix');
//获取当前系统设置的首页路径
getConfigKey('sys.homePage').then(res => {
spinning.value = false;
if (res.code === RESULT_CODE_SUCCESS && res.data) {
if (res.data) {
const asyncComponent = findView(`${res.data}`);
currentComponent.value = defineAsyncComponent(asyncComponent);
spinning.value = true;
getConfigKey('sys.homePage')
.then(res => {
if (res.code === RESULT_CODE_SUCCESS && res.data) {
if (res.data) {
const asyncComponent = findView(`${res.data}`);
currentComponent.value = defineAsyncComponent(asyncComponent);
}
} else {
currentComponent.value = defineAsyncComponent(
() => import('@/views/configManage/neOverview/index.vue')
);
}
} else {
currentComponent.value = defineAsyncComponent(
() => import('@/views/configManage/neOverview/index.vue')
);
}
});
})
.finally(() => {
spinning.value = false;
});
}
});
</script>