fix menu router prop bug when vertical mode

pull/272/merge
baiyaaaaa 2016-10-11 00:55:32 +08:00 committed by cinwell.li
parent c44fa410b6
commit 30003ec594
3 changed files with 10 additions and 5 deletions

View File

@ -15,6 +15,7 @@
- 为 Tree 添加 getCheckedNodes 方法和 node-click、check-change 回调
- 新增 DatePicker 禁用日期功能 #253
- 修复 多选可搜索的 Select 下拉选项自动展开的问题
- 修复 Menu 组件垂直模式下开启 router 属性会立刻跳转的问题 #295
#### 非兼容性更新

View File

@ -28,7 +28,7 @@
},
methods: {
handleClick() {
this.rootMenu.handleSelect(this.index, this.indexPath, this.route);
this.rootMenu.handleSelect(this.index, this.indexPath, this.route || this.index);
}
},
created() {

View File

@ -99,17 +99,21 @@
});
}
if (this.router) {
this.$router.push(route || index);
if (this.router && route) {
this.$router.push(route);
}
}
},
mounted() {
let index = this.activeIndex;
if (index) {
if (index && this.mode === 'vertical') {
let indexPath = this.menuItems[index].indexPath;
this.handleSelect(index, indexPath);
//
indexPath.forEach(index => {
let submenu = this.submenus[index];
submenu && this.openMenu(index, submenu.indexPath);
});
}
}
};