瀏覽代碼

上升下降 定位bug

morphone1995 4 年之前
父節點
當前提交
6669ab4501
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      src/components/icss/AddMedicinePrompt.vue

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

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