From 38bf490e8644f81a43c569ef61dea9767a46ee4b Mon Sep 17 00:00:00 2001 From: Jen Looper Date: Fri, 1 Jan 2021 11:16:47 -0500 Subject: [PATCH] get language of quiz by query param --- quiz-app/src/App.vue | 8 ++++++-- quiz-app/src/components/Quiz.vue | 9 +++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/quiz-app/src/App.vue b/quiz-app/src/App.vue index 4bbb1cc0..0e66a7a6 100644 --- a/quiz-app/src/App.vue +++ b/quiz-app/src/App.vue @@ -5,7 +5,6 @@ @@ -29,13 +28,18 @@ export default { Quiz, }, data() { - return { locale: "en" }; + return { + locale: "en", + }; }, watch: { locale(val) { this.$root.$i18n.locale = val; }, }, + created() { + this.locale = this.$route.query.loc; + }, }; diff --git a/quiz-app/src/components/Quiz.vue b/quiz-app/src/components/Quiz.vue index 08ac27cf..60dee99d 100644 --- a/quiz-app/src/components/Quiz.vue +++ b/quiz-app/src/components/Quiz.vue @@ -1,10 +1,9 @@