From 764ce644faee4946e30dc4d0bbcc306e00884b3e Mon Sep 17 00:00:00 2001 From: DaehunGwak Date: Thu, 31 Dec 2020 03:03:52 +0900 Subject: [PATCH] Update questions data using computed When I click another language option in quiz component, the quiz sentence is not changed to another language. So I refactor questions 'data' to 'computed' --- quiz-app/src/components/Quiz.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/quiz-app/src/components/Quiz.vue b/quiz-app/src/components/Quiz.vue index 14185123..f1f504ea 100644 --- a/quiz-app/src/components/Quiz.vue +++ b/quiz-app/src/components/Quiz.vue @@ -28,15 +28,20 @@ import messages from "@/assets/translations"; export default { + name: "Quiz", data() { return { currentQuestion: 0, complete: false, error: false, route: "", - questions: this.$t("quizzes"), }; }, + computed: { + questions() { + return this.$t("quizzes"); + } + }, i18n: { messages }, methods: {