Files
fe.ems.vue3/src/views/index.vue

53 lines
1.5 KiB
Vue

<script setup lang="ts">
import Index from '@/views/index/tenantIndex.vue';
import defalutIndex from '@/views/index/defaultIndex.vue';
import Dash from '@/views/dashboard/overview/index.vue';
import Gold from '@/views/perfManage/goldTarget/index.vue';
import { getConfigKey } from '@/api/system/config';
import { defineAsyncComponent, onMounted, shallowRef } from 'vue';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import useUserStore from '@/store/modules/user';
const currentComponent = shallowRef(
defineAsyncComponent(() => import('@/views/index/defaultIndex.vue'))
);
// function loadComponent(sysValue: String) {
// //PS:import不允许变量形式 也有人说左右都穿插字符串即可---经测试不行
// // currentComponent.value = defineAsyncComponent(
// // () => import(`@/views/${selectedComponent.value}.vue`)
// // );
// switch (sysValue) {
// case 'Index':
// currentComponent.value = Index;
// break;
// case 'Gold':
// currentComponent.value = Gold;
// break;
// case 'Dash':
// currentComponent.value = Dash;
// break;
// }
// }
onMounted(() => {
// getConfigKey('sys.indexModule').then(res => {
// if (res.code === RESULT_CODE_SUCCESS && res.data) {
// loadComponent(res.data);
// }
// });
if (useUserStore().roles.includes('tenant')) {
currentComponent.value = Index;
}
});
</script>
<template>
<component :is="currentComponent" />
</template>
<style lang="less" scoped></style>