diff --git a/src/page/index/index.vue b/src/page/index/index.vue index d5625a3697c41bfdf05788f3946acecea3b97b85..651d4880ed2a8f074a9ed2b8ba7cc836d7edfa33 100644 --- a/src/page/index/index.vue +++ b/src/page/index/index.vue @@ -111,19 +111,26 @@ export default { if (item.path) { itemActive = item; } else { - if (this.menu[childItemActive].length == 0) { - itemActive = this.menu[childItemActive]; - } else { - itemActive = this.menu[childItemActive].children[childItemActive]; + if (this.menu[childItemActive]) { + if (this.menu[childItemActive].length === 0) { + itemActive = this.menu[childItemActive]; + } else { + if (this.menu[childItemActive].children) { + itemActive = this.menu[childItemActive].children[childItemActive]; + } + } } } this.$store.commit('SET_MENUID', item); - this.$router.push({ - path: this.$router.$avueRouter.getPath({ - name: itemActive.label, - src: itemActive.path - }, itemActive.meta) - }); + // 如果path不为空才执行跳转页面 + if (itemActive.path) { + this.$router.push({ + path: this.$router.$avueRouter.getPath({ + name: itemActive.label, + src: itemActive.path + }, itemActive.meta) + }); + } } });