From f99412c6d6786077ceb0bac2919b8bedbf9b9fdc Mon Sep 17 00:00:00 2001 From: Rekord <1324596506@qq.com> Date: Sat, 15 Apr 2023 15:29:35 +0800 Subject: [PATCH] perf: do not reload page if not really change locale --- src/components/ToolBar/ToolBarBottom.vue | 1 - src/mixins/i18nMixin.js | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ToolBar/ToolBarBottom.vue b/src/components/ToolBar/ToolBarBottom.vue index 165647e..b66c916 100644 --- a/src/components/ToolBar/ToolBarBottom.vue +++ b/src/components/ToolBar/ToolBarBottom.vue @@ -205,7 +205,6 @@ export default { methods: { handleCommand(lang) { this.$i18n.locale = lang; - this.$router.go(0); }, exitSystem() { window.sessionStorage.removeItem("user"); diff --git a/src/mixins/i18nMixin.js b/src/mixins/i18nMixin.js index 0250862..0c40024 100644 --- a/src/mixins/i18nMixin.js +++ b/src/mixins/i18nMixin.js @@ -8,6 +8,7 @@ export default { currentLocale(newVal, oldVal) { console.log(`Language changed from ${oldVal} to ${newVal}`); localStorage.setItem("locale", newVal); + this.$router.go(0); }, }, };