Skip to content

Commit 70dffc7

Browse files
修复标签导航bug
1 parent 3bcb620 commit 70dffc7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/components/main/main.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ export default {
145145
/**
146146
* @description 初始化设置面包屑导航和标签导航
147147
*/
148+
this.setTagNavList()
148149
this.addTag({
149150
route: this.$store.state.app.homeRoute
150151
})
151-
this.setTagNavList()
152152
this.setBreadCrumb(this.$route)
153153
// 设置初始语言
154154
this.setLocal(this.$i18n.locale)

src/store/module/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ export default {
4444
if (list) {
4545
tagList = [...list]
4646
} else tagList = getTagNavListFromLocalstorage()
47-
if (tagList[0].name !== homeName) tagList.shift()
47+
if (tagList[0] && tagList[0].name !== homeName) tagList.shift()
4848
let homeTagIndex = tagList.findIndex(item => item.name === homeName)
49-
if (homeTagIndex !== 0) {
49+
if (homeTagIndex > 0) {
5050
let homeTag = tagList.splice(homeTagIndex, 1)[0]
5151
tagList.unshift(homeTag)
5252
}

0 commit comments

Comments
 (0)