Browse Source

修改单选的删除问题

秦鹏 3 năm trước cách đây
mục cha
commit
77187486c5

+ 2 - 2
src/components/Adult/common/SingleModule.vue

@@ -91,7 +91,7 @@ export default {
   components: {
     Upload,
   },
-  props: ["curQueItem", "index", "changAnswer", "deleteOptionOne", "type"],
+  props: ["curQueItem", "index", "toIndex","changAnswer", "deleteOptionOne", "type"],
   data() {
     return {
       imgNumber: 10,
@@ -115,7 +115,7 @@ export default {
         cancelButtonText: "取消",
         type: "warning",
       }).then(() => {
-        this.deleteOptionOne(this.index);
+        this.deleteOptionOne(this.index,this.toIndex);
       });
     },
     //   修改正确答案

+ 5 - 3
src/components/Adult/inputModules/Single.vue

@@ -98,6 +98,8 @@
         <SingleModule
           :curQueItem="item"
           :index="index"
+          :toIndex="toIndex"
+
           :changAnswer="changAnswer"
           :deleteOptionOne="deleteOptionOne"
           :type="type"
@@ -347,12 +349,12 @@ export default {
       this.curQue.splice(index, 1);
     },
     // 删除其中一个选项
-    deleteOptionOne(index) {
-      if (this.curQue.option.length <= 2) {
+    deleteOptionOne(index, toIndex) {
+      if (this.curQue[toIndex].option.length <= 2) {
         this.$message.warning("至少要保留两个选项");
         return;
       }
-      this.curQue.option.splice(index, 1);
+      this.curQue[toIndex].option.splice(index, 1);
     },
     // 添加一个题
     addtopic() {