2019-03-20 07:55:02 +00:00
|
|
|
<template>
|
|
|
|
<div class="question mt-4">
|
|
|
|
<h5>{{ question.question }}</h5>
|
|
|
|
<div class="options ml-2">
|
|
|
|
<div v-for="option in question.options" :key="option.name" class="form-check pb-1">
|
2019-03-29 07:15:08 +00:00
|
|
|
<input v-model="checked" class="form-check-input" type="checkbox" :name="question.name" :id="option.name" :value="option.name" @change="emitResponse(question.name, option.name)" :disabled="isDisabled">
|
2019-03-20 07:55:02 +00:00
|
|
|
<label class="form-check-label" :for="option.name">
|
|
|
|
{{ option.option }}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2019-03-29 07:15:08 +00:00
|
|
|
props: ['question', 'isDisabled'],
|
2019-03-20 07:55:02 +00:00
|
|
|
name: 'QuizSingleChoice',
|
2019-03-27 12:31:14 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
checked: []
|
|
|
|
}
|
|
|
|
},
|
2019-03-20 07:55:02 +00:00
|
|
|
methods: {
|
|
|
|
emitResponse(q, o) {
|
2019-03-27 12:31:14 +00:00
|
|
|
console.log(this.checked)
|
|
|
|
this.$emit('updateResponse', {'question':q , 'option': this.checked, 'type': this.question.type})
|
2019-03-20 07:55:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="css" scoped>
|
|
|
|
</style>
|