处理web模块一级菜单不默认展开的问题
This commit is contained in:
parent
54877142f5
commit
ab87528cca
|
@ -104,22 +104,27 @@ export default {
|
||||||
console.log("路由信息",this.menus);
|
console.log("路由信息",this.menus);
|
||||||
// this.initDefaultKeys(this.menus[0])
|
// this.initDefaultKeys(this.menus[0])
|
||||||
// 将从缓存中取出openKeys
|
// 将从缓存中取出openKeys
|
||||||
const openKeys = window.sessionStorage.getItem('openKeys')
|
// const openKeys = window.sessionStorage.getItem('openKeys')
|
||||||
const selectedKeys = window.sessionStorage.getItem('currMenu')
|
const selectedKeys = window.sessionStorage.getItem('currMenu')
|
||||||
if (selectedKeys) {
|
if (selectedKeys) {
|
||||||
this.defaultSelectedKeys.push(selectedKeys)
|
this.defaultSelectedKeys.push(selectedKeys)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.initDefaultKeys(this.menus[0])
|
this.initDefaultKeys(this.menus[0])
|
||||||
}
|
}
|
||||||
if (openKeys) {
|
console.log(this.menus);
|
||||||
// 存在即赋值
|
this.menus.forEach(item => {
|
||||||
this.defaultOpenKeys = JSON.parse(openKeys)
|
if (item.name!=="istatistics-data") {
|
||||||
}
|
this.defaultOpenKeys.push(item.path)
|
||||||
if (openKeys) {
|
|
||||||
// 存在即赋值
|
|
||||||
this.openKeys = JSON.parse(openKeys)
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
// if (openKeys) {
|
||||||
|
// // 存在即赋值
|
||||||
|
// this.defaultOpenKeys = JSON.parse(openKeys)
|
||||||
|
// }
|
||||||
|
// if (openKeys) {
|
||||||
|
// // 存在即赋值
|
||||||
|
// this.openKeys = JSON.parse(openKeys)
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 点击菜单,路由跳转,注意的是当点击MenuItem才会触发此函数
|
// 点击菜单,路由跳转,注意的是当点击MenuItem才会触发此函数
|
||||||
|
@ -135,6 +140,9 @@ export default {
|
||||||
},
|
},
|
||||||
initDefaultKeys(data) {
|
initDefaultKeys(data) {
|
||||||
this.defaultOpenKeys.push(data.path)
|
this.defaultOpenKeys.push(data.path)
|
||||||
|
// if (data.children) {
|
||||||
|
if (data.name!=="istatistics-StateOfHealth-alerts") {
|
||||||
|
|
||||||
data.children.some((f) => {
|
data.children.some((f) => {
|
||||||
if (f.children) {
|
if (f.children) {
|
||||||
// 第一个节点展开
|
// 第一个节点展开
|
||||||
|
@ -146,6 +154,10 @@ export default {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
// } else {
|
||||||
|
// this.defaultOpenKeys.push(data.path)
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
onOpenChange(openKeys) {
|
onOpenChange(openKeys) {
|
||||||
// 将当前打开的父级菜单存入缓存中
|
// 将当前打开的父级菜单存入缓存中
|
||||||
|
|
Loading…
Reference in New Issue
Block a user