Procházet zdrojové kódy

修改删除第一题问题

dusenyao před 1 rokem
rodič
revize
fefd1e7288
1 změnil soubory, kde provedl 4 přidání a 2 odebrání
  1. 4 2
      src/views/exercise_questions/create/index.vue

+ 4 - 2
src/views/exercise_questions/create/index.vue

@@ -293,8 +293,10 @@ export default {
     deleteQuestion() {
       DeleteQuestion({ question_id: this.index_list[this.curIndex].id })
         .then(() => {
-          this.curIndex = Math.max(0, this.curIndex - 1);
-          this.getExerciseQuestionIndexList();
+          let index = this.curIndex - 1;
+          this.curIndex = Math.max(0, index);
+          // 当删除的题目是第一题时,需要重新获取题目信息,因为 curIndex 没有变化
+          this.getExerciseQuestionIndexList(index < 0);
           this.$message.success('删除成功');
         })
         .catch(() => {