mirror of
https://github.com/microsoft/Web-Dev-For-Beginners.git
synced 2025-09-01 10:42:41 +02:00
update quiz app dependencies
This commit is contained in:
@@ -1,10 +1,20 @@
|
||||
<template>
|
||||
<div>
|
||||
<nav>
|
||||
<router-link class="navlink" to="/">Home</router-link>
|
||||
<router-link
|
||||
class="navlink"
|
||||
to="/"
|
||||
>
|
||||
Home
|
||||
</router-link>
|
||||
<label for="locale">locale</label>
|
||||
<select v-model="locale">
|
||||
<option v-for="localeName in availableLocales" :key="localeName">{{ localeName }}</option>
|
||||
<option
|
||||
v-for="localeName in availableLocales"
|
||||
:key="localeName"
|
||||
>
|
||||
{{ localeName }}
|
||||
</option>
|
||||
</select>
|
||||
</nav>
|
||||
<div id="app">
|
||||
|
@@ -1,21 +1,34 @@
|
||||
<template>
|
||||
<div class="card">
|
||||
<div v-for="q in questions" :key="q.id">
|
||||
<div
|
||||
v-for="q in questions"
|
||||
:key="q.id"
|
||||
>
|
||||
<div v-if="route == q.id">
|
||||
<h2>{{ q.title }}</h2>
|
||||
<hr />
|
||||
<h3 v-if="complete" class="message">{{ $t("complete") }}</h3>
|
||||
<hr>
|
||||
<h3
|
||||
v-if="complete"
|
||||
class="message"
|
||||
>
|
||||
{{ $t("complete") }}
|
||||
</h3>
|
||||
<div v-else>
|
||||
<h3 v-if="error" class="error">{{ $t("error") }}</h3>
|
||||
<h3
|
||||
v-if="error"
|
||||
class="error"
|
||||
>
|
||||
{{ $t("error") }}
|
||||
</h3>
|
||||
<h2>
|
||||
{{ q.quiz[currentQuestion].questionText }}
|
||||
</h2>
|
||||
<div>
|
||||
<button
|
||||
:key="index"
|
||||
v-for="(option, index) in q.quiz[currentQuestion].answerOptions"
|
||||
@click="handleAnswerClick(option.isCorrect)"
|
||||
:key="index"
|
||||
class="btn ans-btn"
|
||||
@click="handleAnswerClick(option.isCorrect)"
|
||||
>
|
||||
{{ option.answerText }}
|
||||
</button>
|
||||
@@ -47,6 +60,10 @@ export default {
|
||||
},
|
||||
|
||||
i18n: { messages },
|
||||
created() {
|
||||
this.route = this.$route.params.id;
|
||||
this.locale = this.$route.query.loc;
|
||||
},
|
||||
methods: {
|
||||
handleAnswerClick(isCorrect) {
|
||||
this.error = false;
|
||||
@@ -63,9 +80,5 @@ export default {
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.route = this.$route.params.id;
|
||||
this.locale = this.$route.query.loc;
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user