[Bug] Fix version nav button loaded multiple times in docs website header (#7062)

* Fix version nav button loaded multiple times

Co-authored-by: 943155336 <wangyongfeng>
Co-authored-by: jiafeng.zhang <zhangjf1@gmail.com>
This commit is contained in:
wangyongfeng
2021-11-09 18:23:44 +08:00
committed by GitHub
parent 088a16d33b
commit 4c6cbdf463

View File

@ -42,9 +42,9 @@ export default {
.get("/versions.json")
.then(res => {
Object.keys(this.$site.themeConfig.locales).forEach(k => {
this.$site.themeConfig.locales[k].nav = this.$site.themeConfig.locales[k].nav.concat(
res.data[k.replace(/\//gi, "")] || []
)
const nav = res.data[k.replace(/\//gi, "")] || []
const localNav = nav.filter(item => this.$site.themeConfig.locales[k].nav.every(v => v.text !== item.text))
this.$site.themeConfig.locales[k].nav = this.$site.themeConfig.locales[k].nav.concat(localNav)
})
this.renderIndex = 1
})