let query = wx.createSelectorQuery().in(this);
query.select("#app_calendar").boundingClientRect(function (res) {
console.log("rect2", res)
if (res) {
// that.setData({
// fixedTopHeight: rect.height
// })
console.log(res.height)
}
}).exec();
后面的.in(this)代表在组件中查询,加上就好使了
本文介绍了如何在微信小程序中使用wx.createSelectorQuery方法来获取#app_calendar元素的边界矩形信息,展示了在组件内部进行DOM操作的技术细节。
3705

被折叠的 条评论
为什么被折叠?



