Comments (1)
已经解决了,原来是作者为了方便添加路由,把路由从有children的 二层数组扁平化为一层数组了,导致子路由必须写完整路径才行,解决方案如下:
在 /src/routers/modules/dynamicRouter.ts
文件中把 相关代码替换掉
// 3.添加动态路由(扁平化添加路由的方式会把子路由提升到和父路由同级,便无法在父路由中使用router-view标签来切换子路由 )
// authStore.flatMenuListGet.forEach(item => {
// item.children && delete item.children
// if (item.component && typeof item.component == 'string') {
// item.component = modules['/src/views' + item.component + '.vue']
// }
// if (item.meta.isFull) {
// router.addRoute(item as unknown as RouteRecordRaw)
// } else {
// router.addRoute('layout', item as unknown as RouteRecordRaw)
// }
// })
// 3.添加动态路由
const routeList = authStore.authMenuListGet.map(item => {
const routeItem = {
path: item.path,
name: item.name,
component: typeof item.component == 'string' ? modules['/src/views' + item.component + '.vue'] : null,
meta: item.meta,
children: [] as any
}
// 如果当前路由有子路由,则遍历子路由项并创建对应的子路由配置对象
if (item.children && item.children.length > 0) {
routeItem.children = item.children.map(child => ({
path: child.path,
name: child.name,
component: typeof child.component == 'string' ? modules['/src/views' + child.component + '.vue'] : null,
meta: child.meta
}))
}
return routeItem
})
// 将路由配置数组动态添加到 Vue Router 中
routeList.forEach((route: RouteRecordRaw) => {
if (route.meta?.isFull) {
router.addRoute(route as unknown as RouteRecordRaw)
} else {
router.addRoute('layout', route as unknown as RouteRecordRaw)
}
})
from geeker-admin.
Related Issues (20)
- 打包之后放在服务器上进不去
- v-copy 在复制失败时,仍提示复制成功 HOT 1
- 本地调试mock接口500 服务器异常
- 感觉这里封装的太复杂了,Geeker-Admin-master\src\api\index.ts HOT 2
- 鼠标文字光标颜色是白色的以及收缩边框图标
- 希望优化Protable的columns Prop Enum 接口获取数据函数! HOT 2
- 官方最新的DevTools7插件安装后无法与vite插件兼容,望作者大大优化下 HOT 2
- 剩余待完善功能还会更新吗 HOT 2
- Protable如何在SearchColumns中添加关键字搜索的input? HOT 3
- 你能不能有一个通用的方法, 将 table 的属性导出或传入 HOT 1
- 有无编辑单元格的功能 HOT 3
- 右键菜单是否支持?
- 手机移动端适配 HOT 3
- ElementPlusError: [el-input] [API] label is about to be deprecated in version 2.8.0, please use aria-label instead.
- protable,搜索条件中,defaultValue 有值的时候, 无法清除默认值, 就是说search配置项中的defaultValue 有值, clearable设置为true, 虽然可以清除页面上显示的值, 但是搜索的时候, 默认值还会带上, HOT 4
- 修改prettier配置后,如何格式化全局代码
- proTable 使用:show-overflow-tooltip="false" 无法生效,需要在columns每一项单独配置才生效 HOT 1
- 使用 npm build:dev出现错误
- 使用 npm run build:dev 出现'vue-tsc' 不是内部或外部命令,也不是可运行的程序 或批处理文件。
- Geeker-Admin 后端配套框架 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geeker-admin.