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