林旭祥 пре 5 месеци
родитељ
комит
683bce5c48
1 измењених фајлова са 4 додато и 3 уклоњено
  1. 4 3
      src/views/sunshineRun/index.vue

+ 4 - 3
src/views/sunshineRun/index.vue

@@ -272,10 +272,11 @@ const initSunshineRun = () => {
       let myIndex = testList.value.findIndex((item: any) => {
         return item.student_id == e.data.student_id;
       })
-      if (myIndex != undefined) {
-        testList.value.splice(myIndex, 1);
+      if (myIndex != -1) {
+        //如果已经存在就删除
+        testList.value.splice(myIndex, 1);//删除数据
       }
-      testList.value.unshift(e.data);
+      testList.value.unshift(e.data);//插入数据
     }
   });
 };