Ver Fonte

取高修改

zhaoxiaohai há 3 anos atrás
pai
commit
cbe5e45762
2 ficheiros alterados com 22 adições e 10 exclusões
  1. 13 7
      components/Yl_filtrate/index.js
  2. 9 3
      components/Yl_nav/index.js

+ 13 - 7
components/Yl_filtrate/index.js

@@ -3,16 +3,22 @@ Component({
     properties: {
         show: Boolean,
         handle: Function, //按钮回调函数
-        zIndex:{
-            type:String,
-            value:99999,
+        zIndex: {
+            type: String,
+            value: 99999,
         },
     },
     lifetimes: {
         ready() {
-            getHeight.getHeight('.head', this).then(res => this.setData({
-                listHeight: res - 130
-            }));
+            let windowHeight = 0,
+                that = this;
+            wx.getSystemInfo({
+                success: (res => windowHeight = res.windowHeight)
+            });
+            let query = wx.createSelectorQuery().in(that).select(".head").boundingClientRect();
+            query.exec(res => that.setData({
+                listHeight: (windowHeight - res[0].bottom - 80) * 2
+            }))
         }
     },
     methods: {
@@ -22,7 +28,7 @@ Component({
             } = e.target.dataset;
             if (name) this.triggerEvent("handle", name)
         },
-        onClose(){
+        onClose() {
             this.triggerEvent("handle", "close")
         }
     }

+ 9 - 3
components/Yl_nav/index.js

@@ -31,9 +31,15 @@ Component({
             })
         },
         ready() {
-            getHeight.getHeight('.Yl_head', this).then(res => this.setData({
-                listHeight: res - 130
-            }));
+            let windowHeight = 0,
+                that = this;
+            wx.getSystemInfo({
+                success: (res => windowHeight = res.windowHeight)
+            });
+            let query = wx.createSelectorQuery().in(that).select('.Yl_head').boundingClientRect();
+            query.exec(res => that.setData({
+                listHeight: (windowHeight - res[0].bottom - 80) * 2
+            }))
         }
     },
     methods: {