mirror of
https://github.com/microsoft/Web-Dev-For-Beginners.git
synced 2025-08-26 08:07:01 +02:00
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'
This commit is contained in:
@@ -28,15 +28,20 @@
|
|||||||
import messages from "@/assets/translations";
|
import messages from "@/assets/translations";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
name: "Quiz",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
currentQuestion: 0,
|
currentQuestion: 0,
|
||||||
complete: false,
|
complete: false,
|
||||||
error: false,
|
error: false,
|
||||||
route: "",
|
route: "",
|
||||||
questions: this.$t("quizzes"),
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
questions() {
|
||||||
|
return this.$t("quizzes");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
i18n: { messages },
|
i18n: { messages },
|
||||||
methods: {
|
methods: {
|
||||||
|
Reference in New Issue
Block a user