微信小程序获取自定义元素的宽高、使用”事件穿透”来达到状态同步的效果
微信小程序获取元素宽高的方式:
// 自定义组件需要用:this.createSelectorQuery()
const query = wx.createSelectorQuery()
query.select('.my-class').boundingClientRect(res => {
this.setData({
itemHeight: res.height,
itemW...
原创
2020-03-28 20:04:54 ·
3578 阅读 ·
0 评论