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

View File

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