Quellcode durchsuchen

上升下降 定位bug

morphone1995 vor 4 Jahren
Ursprung
Commit
6669ab4501
1 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen
  1. 5 5
      src/components/icss/AddMedicinePrompt.vue

+ 5 - 5
src/components/icss/AddMedicinePrompt.vue

@@ -364,6 +364,8 @@ export default {
       }
     },
     reOrder(isUp, i) {
+      // isUp: 1 上升    0 下降
+      let div = this.$refs['elscrollbar'].$refs['wrap'];
       let temp = {},
         it = {};
       if (isUp === 1) {
@@ -374,10 +376,9 @@ export default {
         temp = Object.assign(this.form.prags[i - 1]);
         it = Object.assign(this.form.prags[i]);
         this.form.prags.splice(i - 1, 2, it, temp);
-        // this.$nextTick(() => {
-        //   console.log(this.$refs.subForm[i].$el);
-        //   this.$refs.subForm[i].$el.scrollIntoView()
-        // });
+        this.$nextTick(() => {
+          div.scrollTop = this.$refs.subForm[i-1].$el.offsetTop -48;
+        });
       } else {
         if (i === this.form.prags.length - 1) {
           this.warning('已经是最后一个,不能再降啦!');
@@ -546,7 +547,6 @@ export default {
             div.scrollTop = 0;
           });
         }
-
         return;
       }
       //通过必填验证,提交保存