赞
踩
将要获取的元素id 或者class传入即可
文档地址https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html
// 获取元素高度
getPaddingTopFn() {
let that = this;
wx.createSelectorQuery().selectAll('.header').boundingClientRect(function (rects) {
that.setData({
console.log(rects)
})
}).exec();
},
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。