调整 iam

This commit is contained in:
2026-09-16 06:30:30 +08:00
parent 6a87066097
commit c1c4fa18c9
26 changed files with 1517 additions and 666 deletions
+13 -10
View File
@@ -2,6 +2,7 @@ import website from '@/config/website';
import { getToken } from '@/utils/auth';
import store from '@/store';
import { generateIframePath, processUrlForQuery, isURL } from './router';
import { wrapViewLoader } from '@/utils/chunk-reload';
const modules = import.meta.glob('../**/**/*.vue');
// 将多级路由扁平化为二级路由,支持 keep-alive 跨层级缓存
@@ -96,21 +97,23 @@ RouterPlugin.install = function (option = {}) {
component: (() => {
// 判断是否为首路由
if (first) {
return modules[
option.store.getters.isMacOs || !website.setting.menu
? '../page/index/layout.vue'
: '../page/index/index.vue'
];
return wrapViewLoader(
modules[
option.store.getters.isMacOs || !website.setting.menu
? '../page/index/layout.vue'
: '../page/index/index.vue'
]
);
// 判断是否为多层路由
} else if (isChild && !first) {
return modules['../page/index/layout.vue'];
return wrapViewLoader(modules['../page/index/layout.vue']);
// 判断是否为最终的页面视图
} else {
let result = modules[`../${component}.vue`];
if (!result) {
isComponent = false;
}
return result;
return wrapViewLoader(result);
}
})(),
name,
@@ -127,7 +130,7 @@ RouterPlugin.install = function (option = {}) {
if (first) {
oMenu[propsDefault.path] = `${path}`;
let componentPath = oMenu.component || component;
let result = modules[`../${componentPath}.vue`];
let result = wrapViewLoader(modules[`../${componentPath}.vue`]);
if (!result) {
isComponent = false;
}
@@ -173,7 +176,7 @@ export const formatPath = (ele, first) => {
const icon = ele[propsDefault.icon];
ele[propsDefault.icon] = icon || '';
ele.meta = {
keepAlive: ele.isOpen === 2,
keepAlive: true,
};
const iframeComponent = 'components/iframe/main';
const iframeSrc = href => {
@@ -215,7 +218,7 @@ export const formatPath = (ele, first) => {
ele[propsDefault.children].forEach(child => {
child.component = 'views' + child[propsDefault.path];
child.meta = {
keepAlive: child.isOpen === 2,
keepAlive: true,
};
if (isURL(child[propsDefault.href])) {
let href = child[propsDefault.href];
+1 -1
View File
@@ -128,5 +128,5 @@ export function tabView(route, Component) {
};
wrapperMap.set(tabKey, wrapper);
}
return h(wrapper);
return wrapper;
}