microsoft/AI-For-Beginners

Public

mirrored fromhttps://github.com/microsoft/AI-For-BeginnersAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
update-translations

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

etc/quiz-app/src/views/Home.vue

51lines · modecode

1<template>
2<div>
3 <div v-for="q in questions[currLocale]" :key="q.id">
4
5 <router-link
6 v-for="quiz in q.quizzes"
7 :key="quiz.id"
8 :to="`quiz/${quiz.id}`"
9 class="link"
10 >
11 {{ quiz.title }}
12 </router-link>
13
14 </div>
15 </div>
16</template>
17
18<script>
19import messages from "@/assets/translations";
20
21export default {
22 name: "Home",
23 data() {
24 return {
25 locale: "",
26 };
27 },
28 computed: {
29 questions() {
30 return messages;
31 },
32 currLocale() {
33 return this.$root.$i18n.locale;
34 }
35 },
36 i18n: { messages },
37 watch: {
38 locale(val) {
39 this.$root.$i18n.locale = val;
40 },
41 },
42 created() {
43 this.route = this.$route.params.id;
44 if (this.$route.query.loc) {
45 this.locale = this.$route.query.loc;
46 } else {
47 this.locale = "en";
48 }
49 },
50};
51</script>