鍍金池/ 問(wèn)答/網(wǎng)絡(luò)安全  HTML/ 小程序獲取節(jié)點(diǎn)高度賦值給其他

小程序獲取節(jié)點(diǎn)高度賦值給其他

圖片描述

這個(gè)賦值打印出來(lái)還是空的

找到原因了 workheight有值的

下載下面這個(gè)回調(diào)中就可以了
wx.createSelectorQuery().select('#playerinfo').boundingClientRect(function (rect) {

}).exec(function (res) {

      that.data.wschatautoHeight = (app.globalData.workHeight - res[0].bottom)+'px';
      that.setData({ wschatautoHeight: that.data.wschatautoHeight})

})

回答
編輯回答
拼未來(lái)

workHeight本身有值么?

2018年8月9日 17:44