فهرست منبع

fix: 修复 true or false eidtor 里的 null 异常

WuXinyu 6 سال پیش
والد
کامیت
0cdbb28f4e
2فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 1 1
      src/views/quiz/components/QuestionEditorFactory.vue
  2. 4 3
      src/views/quiz/components/TrueFalseQuestionEditor.vue

+ 1 - 1
src/views/quiz/components/QuestionEditorFactory.vue

@@ -14,7 +14,7 @@ export default {
   props: {
     initValue: {
       type: Object,
-      default: () => null
+      default: () => ({})
     },
     kind: {
       type: String,

+ 4 - 3
src/views/quiz/components/TrueFalseQuestionEditor.vue

@@ -55,7 +55,9 @@ export default {
   watch: {
     value: {
       deep: true,
-      handler: nextValue => this.$emit('input', nextValue)
+      handler(nextValue) {
+        return this.$emit('input', nextValue)
+      }
     },
     initValue: {
       deep: true,
@@ -67,9 +69,8 @@ export default {
   },
   methods: {
     handleSubmit() {
-      const { stem, options, answer, analysis } = this.value
+      const { stem, answer, analysis } = this.value
       if (!stem) this.$setErrorMessage('请输入题干')
-      else if (!options?.A) this.$setErrorMessage('请输入选项')
       else if (!answer) this.$setErrorMessage('请选择答案')
       else if (!analysis) this.$setErrorMessage('请输入解析')
       else this.$emit('submit', this.value)