From e8837d161ee2a4793bdf5add1503d472857f6f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Mon, 27 May 2019 15:48:45 +0800 Subject: [PATCH] feat: add tab url demo (#2114) --- src/layout/components/AppMain.vue | 2 +- src/views/tab/index.vue | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/layout/components/AppMain.vue b/src/layout/components/AppMain.vue index 9e12c662..a8976380 100644 --- a/src/layout/components/AppMain.vue +++ b/src/layout/components/AppMain.vue @@ -16,7 +16,7 @@ export default { return this.$store.state.tagsView.cachedViews }, key() { - return this.$route.fullPath + return this.$route.path } } } diff --git a/src/views/tab/index.vue b/src/views/tab/index.vue index e5746580..6438a47a 100644 --- a/src/views/tab/index.vue +++ b/src/views/tab/index.vue @@ -30,6 +30,18 @@ export default { createdTimes: 0 } }, + watch: { + activeName(val) { + this.$router.push(`${this.$route.path}?tab=${val}`) + } + }, + created() { + // init the default selected tab + const tab = this.$route.query.tab + if (tab) { + this.activeName = tab + } + }, methods: { showCreatedTimes() { this.createdTimes = this.createdTimes + 1