Commit ec22da16 authored by 前端-许佳敏's avatar 前端-许佳敏

fix: 修复路由无效

parent 4fc3e47d
...@@ -23,6 +23,7 @@ const config: any = { ...@@ -23,6 +23,7 @@ const config: any = {
}, },
nodeModulesTransform: { nodeModulesTransform: {
type: 'none', type: 'none',
exclude: []
}, },
routes, routes,
extraBabelPlugins: [ extraBabelPlugins: [
......
...@@ -102,6 +102,11 @@ export const removeAuth = () => { ...@@ -102,6 +102,11 @@ export const removeAuth = () => {
removeRouters() removeRouters()
} }
const HOME_URL = [
'/',
'/memberCenter/home'
]
export const asyncRouter = async (routeLists: string[], routes: any[]) => { export const asyncRouter = async (routeLists: string[], routes: any[]) => {
for (let i = 0; i < routes.length; i++) { for (let i = 0; i < routes.length; i++) {
const item = routes[i] const item = routes[i]
...@@ -110,7 +115,7 @@ export const asyncRouter = async (routeLists: string[], routes: any[]) => { ...@@ -110,7 +115,7 @@ export const asyncRouter = async (routeLists: string[], routes: any[]) => {
} else { } else {
// 参与权限校验的页面 // 参与权限校验的页面
// fix: 修复左侧菜单首页无法显示 // fix: 修复左侧菜单首页无法显示
if (item.path && !routeLists.includes(item.path) && item.path !== '/memberCenter/home') { if (item.path && !routeLists.includes(item.path) && !HOME_URL.includes(item.path)) {
item.hideInMenu = true item.hideInMenu = true
item.noAuth = true item.noAuth = true
} }
......
{ {
"compilerOptions": { "compilerOptions": {
"experimentalDecorators": true, "experimentalDecorators": true,
"target": "esnext", "target": "esnext",
"module": "esnext", "module": "esnext",
"moduleResolution": "node", "moduleResolution": "node",
"importHelpers": true, "importHelpers": true,
"jsx": "react", "jsx": "react-jsx",
"esModuleInterop": true, "esModuleInterop": true,
"noImplicitAny": false, "noImplicitAny": false,
"sourceMap": true, "sourceMap": true,
"baseUrl": "./", "baseUrl": "./",
"paths": { "paths": {
"@/*": ["src/*"], "@/*": ["src/*"],
"@mock/*": ["mockStatic/*"], "@mock/*": ["mockStatic/*"],
"@@/*": ["src/.umi/*"] "@@/*": ["src/.umi/*"]
}, },
"allowSyntheticDefaultImports": true "allowSyntheticDefaultImports": true
}, },
"include": [ "include": [
"mock/**/*", "mock/**/*",
"src/**/*", "src/**/*",
"config/**/*", "config/**/*",
".umirc.ts", ".umirc.ts",
"typings.d.ts" "typings.d.ts"
], ],
"exclude": [ "exclude": [
"node_modules/**/*" "node_modules/**/*"
] ]
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment