2020-03-21 21:48:37 +01:00
|
|
|
<style scoped>
|
|
|
|
.question {
|
|
|
|
padding: 0.5em;
|
|
|
|
}
|
|
|
|
|
|
|
|
button {
|
|
|
|
display: block;
|
|
|
|
width: 80%;
|
|
|
|
margin: 0 auto;
|
|
|
|
margin-bottom: 5%;
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
2020-03-21 16:19:14 +01:00
|
|
|
<template>
|
|
|
|
<div class="question">
|
|
|
|
<p>{{ question }}</p>
|
2020-03-21 20:20:55 +01:00
|
|
|
<div v-if="type === 'yesno'" class="question-choice">
|
|
|
|
<button v-on:click="$store.commit('nextQuestion')">Ja</button>
|
|
|
|
<button v-on:click="$store.commit('nextQuestion')">Nein</button>
|
2020-03-21 18:57:15 +01:00
|
|
|
</div>
|
|
|
|
<div v-if="type === 'slider'" class="question-slider">
|
|
|
|
<p>{{ selection }}</p>
|
|
|
|
<input v-model="selection" type="range" min="0" max="150" value="18" class="slider">
|
|
|
|
</div>
|
2020-03-21 20:20:55 +01:00
|
|
|
<div v-if="type === 'choice'" class="question-options">
|
|
|
|
<button v-bind:key="answer.text"
|
|
|
|
v-for="answer in answers"
|
|
|
|
v-on:click="answerQuestion(answer.value)">{{ answer.text }}</button>
|
2020-03-21 18:57:15 +01:00
|
|
|
</div>
|
2020-03-21 22:02:54 +01:00
|
|
|
<router-link to="/questionmaire" style="text-decoration: none"><button class="alert">Ich brauche Hilfe zu dieser Frage</button></router-link>
|
2020-03-21 16:19:14 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: "Question",
|
|
|
|
props: {
|
2020-03-21 18:57:15 +01:00
|
|
|
type: String,
|
2020-03-21 16:19:14 +01:00
|
|
|
question: String,
|
|
|
|
answers: Array
|
2020-03-21 18:57:15 +01:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
selection: 0
|
|
|
|
}
|
|
|
|
},
|
2020-03-21 20:20:55 +01:00
|
|
|
methods: {
|
|
|
|
answerQuestion(value) {
|
|
|
|
this.$store.commit('answerQuestion', value)
|
|
|
|
this.$store.commit('nextQuestion')
|
|
|
|
}
|
|
|
|
},
|
2020-03-21 16:19:14 +01:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
2020-03-21 18:57:15 +01:00
|
|
|
.slider {
|
|
|
|
-webkit-appearance: none;
|
|
|
|
appearance: none;
|
|
|
|
width: 100%;
|
|
|
|
height: 1em;
|
|
|
|
background: #d3d3d3;
|
|
|
|
outline: none;
|
|
|
|
opacity: 0.7;
|
|
|
|
-webkit-transition: .2s;
|
|
|
|
transition: opacity .2s;
|
|
|
|
}
|
|
|
|
|
|
|
|
.slider:hover {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.slider::-webkit-slider-thumb {
|
|
|
|
-webkit-appearance: none;
|
|
|
|
appearance: none;
|
|
|
|
width: 2.5em;
|
|
|
|
height: 2.5em;
|
|
|
|
background: #e94a47;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.slider::-moz-range-thumb {
|
|
|
|
width: 2.5em;
|
|
|
|
height: 2.5em;
|
|
|
|
background: #e94a47;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
2020-03-21 16:19:14 +01:00
|
|
|
|
|
|
|
</style>
|