jianda.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view v-if="question" class="phone-jianda-box">
  3. <view class="phone-shiti-question">
  4. <view class="question-num">{{question.onlyNum}}、</view>
  5. <!-- 题干区域 -->
  6. <rich-text :nodes="question.name"></rich-text>
  7. </view>
  8. <!-- 选项区域 -->
  9. <textarea class="jianda-textarea-box" placeholder="请输入内容" v-model="question.reply" />
  10. <view class="phone-question-answer-box">
  11. <view class="phone-line-title">答案解析</view>
  12. <view class="btdf-row">本题得分:<text>{{data.score}}</text>分</view>
  13. <view class="zqda-row">正确答案:<text>{{data.result}}</text></view>
  14. <view class="ndda-row">您的答案:<text>{{data.reply}}</text></view>
  15. <view class="dajx-row">答案解析:
  16. <rich-text :nodes="data.answer"></rich-text>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script setup>
  22. import {
  23. ref,
  24. reactive,
  25. watch
  26. } from 'vue';
  27. const props = defineProps({
  28. question: {
  29. type: Object,
  30. },
  31. showError: {
  32. type: Boolean,
  33. default: false
  34. }
  35. })
  36. const data = reactive({
  37. name: '', //题干数据
  38. score: '',
  39. result: '',
  40. reply: '',
  41. answer: '',
  42. contents: [], // 选项数据
  43. })
  44. watch(() => props.question, (val) => formatData(val), {
  45. immediate: true
  46. })
  47. function formatData(val) {
  48. if (val) {
  49. console.log('val',val);
  50. data.name = val.name;
  51. data.answer = val.answer;
  52. data.score = val.score;
  53. data.reply = val.reply;
  54. data.result = val.result;
  55. }
  56. }
  57. </script>