QuestionCard.vue 930 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <v-card>
  3. <v-card-title class="font-weight-light">
  4. {{ question.description }}
  5. </v-card-title>
  6. <v-divider />
  7. <v-radio-group v-model="chosenOptions" :multiple="multiple" class="ma-4">
  8. <v-radio
  9. v-for="option in question.options"
  10. :key="option.label"
  11. :value="option.label"
  12. :label="option.description"
  13. />
  14. </v-radio-group>
  15. </v-card>
  16. </template>
  17. <script lang="ts">
  18. import Vue, { PropOptions } from 'vue'
  19. import { Question } from './types'
  20. export default Vue.extend({
  21. props: {
  22. disabled: {
  23. type: Boolean,
  24. default: false
  25. },
  26. question: {
  27. type: Object,
  28. required: true
  29. } as PropOptions<Question>
  30. },
  31. data() {
  32. return {
  33. chosenOptions: []
  34. }
  35. },
  36. computed: {
  37. multiple(): boolean {
  38. return this.question.type === 'choice' && this.question.multiple
  39. }
  40. }
  41. })
  42. </script>
  43. <style scoped></style>