1. 程式人生 > 其它 >微信小程式,獲取元件的高度width、寬度height、id、left、right、top、bottom等資訊

微信小程式,獲取元件的高度width、寬度height、id、left、right、top、bottom等資訊

hideShFn(){ varquery=wx.createSelectorQuery(); query.select('.enterP_01100').boundingClientRect(rect=>{ if(rect.height>60){ this.setData({ hideShow:true }) }else{ this.setData({ hideShow:false }) } }).exec() },
rect.id      // 節點的ID
rect.dataset // 節點的dataset
rect.left    // 節點的左邊界座標
rect.right   // 節點的右邊界座標
rect.top     // 節點的上邊界座標
rect.bottom  // 節點的下邊界座標
rect.width   // 節點的寬度
rect.height  // 節點的高度