Skip to content

Commit e8837d1

Browse files
authored
feat: add tab url demo (#2114)
1 parent f891202 commit e8837d1

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/layout/components/AppMain.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default {
1616
return this.$store.state.tagsView.cachedViews
1717
},
1818
key() {
19-
return this.$route.fullPath
19+
return this.$route.path
2020
}
2121
}
2222
}

src/views/tab/index.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ export default {
3030
createdTimes: 0
3131
}
3232
},
33+
watch: {
34+
activeName(val) {
35+
this.$router.push(`${this.$route.path}?tab=${val}`)
36+
}
37+
},
38+
created() {
39+
// init the default selected tab
40+
const tab = this.$route.query.tab
41+
if (tab) {
42+
this.activeName = tab
43+
}
44+
},
3345
methods: {
3446
showCreatedTimes() {
3547
this.createdTimes = this.createdTimes + 1

0 commit comments

Comments
 (0)