feat: add tab url demo (#2114)

This commit is contained in:
花裤衩 2019-05-27 15:48:45 +08:00 committed by Pan
parent f1bc06b082
commit 6f45fd987d
2 changed files with 13 additions and 1 deletions

View File

@ -16,7 +16,7 @@ export default {
return this.$store.state.tagsView.cachedViews
},
key() {
return this.$route.fullPath
return this.$route.path
}
}
}

View File

@ -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