refs #355 Set side menu active when tag page is opended

This commit is contained in:
AkiraFukushima 2018-06-01 01:19:32 +09:00
parent 59e2fde554
commit 1d1839a0ea
3 changed files with 14 additions and 4 deletions

View File

@ -51,6 +51,7 @@ 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()
@ -83,6 +84,7 @@ export default {
return true
},
reset () {
this.$store.commit('TimelineSpace/SideMenu/updateOverrideActivePath', null)
this.$store.commit('TimelineSpace/Contents/Hashtag/Tag/changeHeading', true)
this.$store.commit('TimelineSpace/Contents/Hashtag/Tag/mergeTimeline')
this.$store.commit('TimelineSpace/Contents/Hashtag/Tag/archiveTimeline')

View File

@ -16,7 +16,7 @@
</div>
</div>
<el-menu
:default-active="$route.path"
:default-active="activeRoute"
:background-color="themeColor"
text-color="#909399"
active-text-color="#ffffff"
@ -48,7 +48,7 @@
<icon name="globe"></icon>
<span>Public timeline</span>
</el-menu-item>
<el-menu-item :index="`/${id()}/hashtag/`">
<el-menu-item :index="`/${id()}/hashtag`">
<icon name="hashtag"></icon>
<span>Hashtag</span>
</el-menu-item>
@ -82,10 +82,14 @@ export default {
unreadNotifications: state => state.TimelineSpace.SideMenu.unreadNotifications,
unreadLocalTimeline: state => state.TimelineSpace.SideMenu.unreadLocalTimeline,
lists: state => state.TimelineSpace.SideMenu.lists,
themeColor: state => state.App.theme.side_menu_color
themeColor: state => state.App.theme.side_menu_color,
overrideActivePath: state => state.TimelineSpace.SideMenu.overrideActivePath
})
},
methods: {
activeRoute () {
return this.overrideActivePath || this.$route.path
},
id () {
return this.$route.params.id
},

View File

@ -6,7 +6,8 @@ const SideMenu = {
unreadHomeTimeline: false,
unreadNotifications: false,
unreadLocalTimeline: false,
lists: []
lists: [],
overrideActivePath: null
},
mutations: {
changeUnreadHomeTimeline (state, value) {
@ -20,6 +21,9 @@ const SideMenu = {
},
updateLists (state, lists) {
state.lists = lists
},
updateOverrideActivePath (state, path) {
state.overrideActivePath = path
}
},
actions: {