!290 修复三级及以上菜单路由缓存失效问题

This commit is contained in:
YunaiV 2022-11-29 22:33:44 +08:00
parent 44249e43dd
commit 53dbf8d82e

View File

@ -60,6 +60,11 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
}
// 路由地址转首字母大写驼峰,作为路由名称,适配 keepAlive
route.name = toCamelCase(route.path, true)
// 处理三级及以上菜单路由缓存问题将path名字赋值给name
if (route.path.indexOf("/") !== -1) {
var pathArr = route.path.split("/")
route.name = toCamelCase(pathArr[pathArr.length - 1], true)
}
route.hidden = !route.visible
// 处理 component 属性
if (route.children) { // 父节点
@ -86,10 +91,10 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
}
function filterChildren(childrenMap, lastRouter = false) {
let children = []
var children = []
childrenMap.forEach((el, index) => {
if (el.children && el.children.length) {
if (el.component === 'ParentView' && !lastRouter) {
if (!el.component && !lastRouter) {
el.children.forEach(c => {
c.path = el.path + '/' + c.path
if (c.children && c.children.length) {