From 660ff765f5f8ad29884a201e463ed68196bc94e8 Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 1 Nov 2017 18:43:06 +0800 Subject: [PATCH] fix:fix tabsView path bug --- src/views/layout/TabsView.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/views/layout/TabsView.vue b/src/views/layout/TabsView.vue index 7f1eaa9f..e0ae6b6c 100644 --- a/src/views/layout/TabsView.vue +++ b/src/views/layout/TabsView.vue @@ -30,13 +30,16 @@ export default { $event.preventDefault() }, generateRoute() { - if (this.$route.matched[this.$route.matched.length - 1].name) { - return this.$route.matched[this.$route.matched.length - 1] + if (this.$route.name) { + return this.$route } - this.$route.matched[0].path = '/' - return this.$route.matched[0] + return false }, addViewTabs() { + const route = this.generateRoute() + if (!route) { + return false + } this.$store.dispatch('addVisitedViews', this.generateRoute()) }, isActive(path) {