4
0
mirror of https://github.com/iczer/vue-antd-admin.git synced 2025-04-06 03:57:44 +08:00

fix: the problem that select events can't be triggered in menu.js component; 🐛 #99

修复:menu.js 组件中 select 事件无法触发的问题;
This commit is contained in:
iczer 2020-08-12 13:19:29 +08:00
parent 088b36aec1
commit b2317e3209

View File

@ -175,7 +175,9 @@ export default {
updateMenu () {
const menuRoutes = this.$route.matched.filter(item => item.path !== '')
const route = menuRoutes.pop()
this.selectedKeys = [this.getSelectedKey(route)]
if(this.selectedKeys.length === 0 || route.meta.invisible) {
this.selectedKeys = [this.getSelectedKey(route)]
}
let openKeys = menuRoutes.map(item => item.path)
if (!fastEqual(openKeys, this.sOpenKeys)) {
this.collapsed || this.mode === 'horizontal' ? this.cachedOpenKeys = openKeys : this.sOpenKeys = openKeys