Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

静态路由添加问题 #539

Open
Greenerly opened this issue Sep 23, 2024 · 2 comments
Open

静态路由添加问题 #539

Greenerly opened this issue Sep 23, 2024 · 2 comments

Comments

@Greenerly
Copy link

添加主页左侧静态路由栏选项时,例如我在“权限管理”选项下方添加一个“Test”选项,首先我在/views/Test里增加了我的组件,该组件完全复制于Guide.vue ,然后我发现在 /src/router/index.ts 里面添加相应路由配置的代码是不会生效的,反而是要在 /mock/role/index.mock.ts 里添加相应代码才能完成这个选项的添加。如下图所示
结合https://element-plus-admin-doc.cn/guide/router.html#%E9%85%8D%E7%BD%AE 里提出的新增路由的方式,我不是很懂/src/router/index.ts里的静态路由的代码有何用处了,烦请作者解答。
image

@Greenerly
Copy link
Author

问题介绍里提到的清空localstorage的操作是做了的,还是有这个疑问

@xxxace
Copy link

xxxace commented Oct 7, 2024

你加的不是静态路由,是动态路由,为什么在mock添加后生效呢?是因为默认是server,它是在mock返回的数据动态添加路由
状态分3种:'server' | 'frontEnd' | 'static',后面两种才是直接拿的asyncRouterMap注册的路由

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants