covidassist/src/views/Questionnaire.vue

61 lines
1.6 KiB
Vue
Raw Normal View History

2020-03-21 16:19:14 +01:00
<template>
<div class="questionmaire">
2020-03-21 22:28:01 +01:00
<div class="progress">
2020-03-21 22:29:34 +01:00
<div v-bind:key="n" v-for="n in $store.state.questions.length - 1" v-bind:class="getDotClass(n)"></div>
2020-03-21 22:28:01 +01:00
</div>
2020-03-21 18:57:15 +01:00
<Question
v-bind:type="$store.state.questions[$store.state.currentQuestion].type"
v-bind:question="$store.state.questions[$store.state.currentQuestion].question"
v-bind:answers="$store.state.questions[$store.state.currentQuestion].answers"></Question>
2020-03-21 16:19:14 +01:00
</div>
</template>
<script>
import Question from "@/components/Question";
export default {
name: "Questionnaire",
2020-03-21 20:20:55 +01:00
components: {Question},
mounted() {
this.$store.commit("init")
2020-03-21 22:28:01 +01:00
},
methods: {
getDotClass(n) {
if (n < this.$store.state.currentQuestion) {
return "point answered"
} else {
return "point"
}
}
},
2020-03-21 16:19:14 +01:00
}
</script>
<style scoped>
2020-03-21 22:28:01 +01:00
.progress {
2020-03-21 23:14:44 +01:00
margin-top: 1em;
2020-03-21 22:28:01 +01:00
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: center;
}
.point {
font-family: sans-serif;
padding: 0.1em 0 0 0;
margin: 0.2em;
width: 0.5em;
height: 0.5em;
border-radius: 50%;
font-size: 0.9em;
color: #000000;
text-align: center;
background: transparent;
border: 2px solid #23286b;
user-select: none;
cursor: pointer;
}
.point.answered {
background-color: #23286b;
}
2020-03-21 16:19:14 +01:00
</style>