do.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <div>
  3. <h1 class="mb-5 display-2 font-weight-light">
  4. {{ $t('learning.exercise.title') }}
  5. </h1>
  6. <question-card v-for="q in questions" :key="q.id" :question="q" class="mb-5" />
  7. <v-row>
  8. <v-col>
  9. <v-btn color="primary" tile outlined block>
  10. {{ $t('learning.exercise.do.commit') }}
  11. </v-btn>
  12. </v-col>
  13. </v-row>
  14. </div>
  15. </template>
  16. <script lang="ts">
  17. import Vue from 'vue'
  18. import QuestionCard from '~/components/learning/QuestionCard.vue'
  19. const mockQuestion = {
  20. description: 'test',
  21. id: 1,
  22. type: 'choice',
  23. multiple: true,
  24. options: [
  25. { label: 'A', description: 'This is the first choice' },
  26. { label: 'B', description: 'This is the second choice' },
  27. { label: 'C', description: 'This is the third choice' },
  28. { label: 'D', description: 'This is the forth choice' }
  29. ]
  30. }
  31. export default Vue.extend({
  32. components: { QuestionCard },
  33. validate({ query }): boolean {
  34. return 'exerciseId' in query
  35. },
  36. data() {
  37. return {
  38. questions: [mockQuestion]
  39. }
  40. },
  41. computed: {
  42. exerciseId(): string {
  43. return this.$route.query.exerciseId as string
  44. }
  45. }
  46. })
  47. </script>
  48. <style scoped></style>