1、在components获取Dom节点的使用
const query = wx.createSelectorQuery().in(this)
query.select('#the-id').boundingClientRect(function(res){
res.top // 这个组件内 #the-id 节点的上边界坐标
}).exec()
本文介绍在小程序中如何利用wx.createSelectorQuery方法获取指定ID的DOM节点,并通过实例演示了如何获得节点的上边界坐标。
1、在components获取Dom节点的使用
const query = wx.createSelectorQuery().in(this)
query.select('#the-id').boundingClientRect(function(res){
res.top // 这个组件内 #the-id 节点的上边界坐标
}).exec()
1541

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