Skip to content

Commit

Permalink
feat: add tab url demo (PanJiaChen#2114)
Browse files Browse the repository at this point in the history
  • Loading branch information
PanJiaChen authored and Trong. Pham Van - CMC Global DU1.19 committed Jul 22, 2022
1 parent 8ff81b6 commit 1254fe3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/layout/components/AppMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
return this.$store.state.tagsView.cachedViews
},
key() {
return this.$route.fullPath
return this.$route.path
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/views/tab/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1254fe3

Please sign in to comment.