修复:菜单组件 openChang 事件的 bug;🐛 #156

fix: the problem of openChange event in menu.js;
master
chenghongxing 4 years ago
parent f74d08248e
commit 9e7a03fcd8
  1. 5
      src/components/menu/menu.js

@ -200,9 +200,10 @@ export default {
}) })
}, },
updateMenu () { updateMenu () {
const menuRoutes = this.$route.matched.filter(item => item.path !== '') const matchedRoutes = this.$route.matched.filter(item => item.path !== '')
this.selectedKeys = this.getSelectedKey(this.$route) this.selectedKeys = this.getSelectedKey(this.$route)
let openKeys = menuRoutes.map(item => item.path) let openKeys = matchedRoutes.map(item => item.path)
openKeys = openKeys.slice(0, openKeys.length -1)
if (!fastEqual(openKeys, this.sOpenKeys)) { if (!fastEqual(openKeys, this.sOpenKeys)) {
this.collapsed || this.mode === 'horizontal' ? this.cachedOpenKeys = openKeys : this.sOpenKeys = openKeys this.collapsed || this.mode === 'horizontal' ? this.cachedOpenKeys = openKeys : this.sOpenKeys = openKeys
} }

Loading…
Cancel
Save