diff --git a/src/views/statistics/RouteView.vue b/src/views/statistics/RouteView.vue index 92abfa9..9bbb728 100644 --- a/src/views/statistics/RouteView.vue +++ b/src/views/statistics/RouteView.vue @@ -3,10 +3,12 @@
+ + { + if (item.name!=="istatistics-data") { + // this.defaultOpenKeys.push(item.path) + this.openKeys.push(item.path) + } + }) + window.sessionStorage.setItem('openKeys', JSON.stringify(this.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) - // } + if (openKeys) { + // 存在即赋值 + this.openKeys = JSON.parse(openKeys) + } }, methods: { // 点击菜单,路由跳转,注意的是当点击MenuItem才会触发此函数 menuClick({ item, key, keyPath }) { + this.currSlecteKey = [] + this.currSlecteKey.push(key) window.sessionStorage.setItem('currMenu', key) // var parentPath = item._props.parentMenu._props.eventKey; // var parentTitle = parentPath.substring(parentPath.lastIndexOf("/") + 1, parentPath.length) @@ -139,18 +146,21 @@ export default { }) }, initDefaultKeys(data) { - this.defaultOpenKeys.push(data.path) + // this.defaultOpenKeys.push(data.path) + this.openKeys.push(data.path) // if (data.children) { if (data.name!=="istatistics-StateOfHealth-alerts") { data.children.some((f) => { if (f.children) { // 第一个节点展开 - this.defaultOpenKeys.push(f.path) + // this.defaultOpenKeys.push(f.path) + this.openKeys.push(f.path) this.initDefaultKeys(f.children[0]) } else { // 选中 - this.defaultSelectedKeys.push(f.path) + // this.defaultSelectedKeys.push(f.path) + this.currSlecteKey.push(f.path) return true } })