mirror of
https://github.com/bufanyun/hotgo.git
synced 2026-02-18 20:34:30 +08:00
up 更新web端依赖包版本,修复潜在错误
This commit is contained in:
@@ -129,10 +129,9 @@ export const dynamicImport = (
|
||||
* 移除隐藏的菜单
|
||||
* @param menus
|
||||
*/
|
||||
export const removeHiddenMenus = (menus: RouteRecordRaw[]) => {
|
||||
const arr = [];
|
||||
export const removeHiddenMenus = (menus: any[]) => {
|
||||
const arr: any[] = [];
|
||||
for (let j = 0; j < menus.length; j++) {
|
||||
// console.log('menus[j]:' + JSON.stringify(menus[j]));
|
||||
if (menus[j].meta?.type === 3) {
|
||||
continue;
|
||||
}
|
||||
@@ -140,19 +139,13 @@ export const removeHiddenMenus = (menus: RouteRecordRaw[]) => {
|
||||
continue;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
if (menus[j].children?.length > 0) {
|
||||
// @ts-ignore
|
||||
menus[j].children = removeHiddenMenus(menus[j].children);
|
||||
if (menus[j].children?.length === 0) {
|
||||
delete menus[j].children;
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
arr.push(menus[j]);
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
return arr;
|
||||
};
|
||||
|
||||
@@ -3,9 +3,10 @@ import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
|
||||
import { RedirectRoute } from '@/router/base';
|
||||
import { PageEnum } from '@/enums/pageEnum';
|
||||
import { createRouterGuards } from './router-guards';
|
||||
import { createRouterIcon } from './router-icons';
|
||||
|
||||
// @ts-ignore
|
||||
const modules = import.meta.globEager('./modules/**/*.ts');
|
||||
const modules = import.meta.glob('./modules/**/*.ts');
|
||||
const routeModuleList: RouteRecordRaw[] = [];
|
||||
|
||||
Object.keys(modules).forEach((key) => {
|
||||
@@ -55,6 +56,7 @@ export function setupRouter(app: App) {
|
||||
app.use(router);
|
||||
// 创建路由守卫
|
||||
createRouterGuards(router);
|
||||
createRouterIcon();
|
||||
}
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import { renderIcon } from '@/utils/index';
|
||||
import { renderIcon } from '@/utils';
|
||||
import * as antdIcons from '@vicons/antd';
|
||||
// import * as x5Icons from '@vicons/ionicons5';
|
||||
|
||||
export const constantRouterIcon = {};
|
||||
for (const element of Object.keys(antdIcons)) {
|
||||
constantRouterIcon[element] = renderIcon(antdIcons[element]);
|
||||
}
|
||||
|
||||
// for (const element of Object.keys(x5Icons)) {
|
||||
// constantRouterIcon[element] = renderIcon(x5Icons[element]);
|
||||
// }
|
||||
export function createRouterIcon() {
|
||||
for (const element of Object.keys(antdIcons)) {
|
||||
constantRouterIcon[element] = renderIcon(antdIcons[element]);
|
||||
}
|
||||
|
||||
// for (const element of Object.keys(x5Icons)) {
|
||||
// constantRouterIcon[element] = renderIcon(x5Icons[element]);
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user