refs #355 Fix side menu highlight when tag page

This commit is contained in:
AkiraFukushima 2018-06-01 13:28:35 +09:00
parent 8ab2ac4ee3
commit 7115ad45fc
3 changed files with 9 additions and 4 deletions

View File

@ -42,7 +42,7 @@ export default {
return this.$route.name === 'tag'
},
back () {
this.$router.push({ name: 'hashtag-list' })
this.$router.push({ path: `/${this.id()}/hashtag` })
}
}
}

View File

@ -51,7 +51,6 @@ export default {
background: 'rgba(0, 0, 0, 0.7)'
})
this.reset()
this.$store.commit('TimelineSpace/SideMenu/updateOverrideActivePath', `${this.$route.params.id}/hashtag`)
this.load(this.$route.params.tag)
.then(() => {
loading.close()
@ -67,6 +66,8 @@ export default {
},
methods: {
async load (tag) {
this.$store.commit('TimelineSpace/SideMenu/updateOverrideActivePath', `/${this.$route.params.id}/hashtag`)
await this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/fetch', tag)
.catch(() => {
this.$message({

View File

@ -16,7 +16,7 @@
</div>
</div>
<el-menu
default-active="activeRoute"
:default-active="activeRoute()"
:background-color="themeColor"
text-color="#909399"
active-text-color="#ffffff"
@ -88,7 +88,11 @@ export default {
},
methods: {
activeRoute () {
return this.overrideActivePath || this.$route.path
if (this.overrideActivePath === null) {
return this.$route.path
} else {
return this.overrideActivePath
}
},
id () {
return this.$route.params.id