From 4c6cbdf4635e48a3465bdfd7302cd3a0faabba42 Mon Sep 17 00:00:00 2001 From: wangyongfeng <943155336@qq.com> Date: Tue, 9 Nov 2021 18:23:44 +0800 Subject: [PATCH] [Bug] Fix version nav button loaded multiple times in docs website header (#7062) * Fix version nav button loaded multiple times Co-authored-by: 943155336 Co-authored-by: jiafeng.zhang --- docs/.vuepress/theme/layouts/Layout.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/.vuepress/theme/layouts/Layout.vue b/docs/.vuepress/theme/layouts/Layout.vue index 57936255fd..98ad313485 100644 --- a/docs/.vuepress/theme/layouts/Layout.vue +++ b/docs/.vuepress/theme/layouts/Layout.vue @@ -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 })