From 899972ae979eccc9094fd8adf2e6e5d60c33c467 Mon Sep 17 00:00:00 2001 From: paidge <paidge_cs@hotmail.com> Date: Tue, 11 Jan 2022 23:10:34 +0100 Subject: [PATCH] keep the good language when going back in history --- components/navigation/Language.vue | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/components/navigation/Language.vue b/components/navigation/Language.vue index 6f1cf36..2e968ba 100644 --- a/components/navigation/Language.vue +++ b/components/navigation/Language.vue @@ -1,6 +1,6 @@ <template> <div> - <select class="form-control" @change="saveLocale($event)" v-model="lang"> + <select class="form-control" @change="saveLocale($event)" v-model="$i18n.locale"> <option v-for="lang in $i18n.locales" :key="lang.code" :value="lang.code">{{ lang.name }}</option> </select> </div> @@ -8,14 +8,9 @@ <script> export default { - data() { - return { - lang: this.$i18n.locale - } - }, methods: { saveLocale(e) { - this.lang = e.target.value + this.$i18n.locale = e.target.value this.$i18n.setLocaleCookie(e.target.value) this.$router.push(this.switchLocalePath(e.target.value)) } -- GitLab