From 6f5fece7e97897309e46d3769d3629f4ded40eb1 Mon Sep 17 00:00:00 2001 From: Pan Date: Mon, 3 Jul 2017 11:16:19 +0800 Subject: [PATCH] fix tabsview bug --- src/views/layout/TabsView.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/views/layout/TabsView.vue b/src/views/layout/TabsView.vue index 5d3a2e19..34b9c860 100644 --- a/src/views/layout/TabsView.vue +++ b/src/views/layout/TabsView.vue @@ -20,8 +20,15 @@ this.$store.dispatch('delVisitedViews', view) $event.preventDefault() }, + generateRoute() { + if (this.$route.matched[this.$route.matched.length - 1].name) { + return this.$route.matched[this.$route.matched.length - 1] + } + this.$route.matched[0].path = '/' + return this.$route.matched[0] + }, addViewTabs() { - this.$store.dispatch('addVisitedViews', this.$route.matched[this.$route.matched.length - 1]) + this.$store.dispatch('addVisitedViews', this.generateRoute()) } }, watch: {