1 页面引入了组件comp:
<comp width= "172.5" > <view class= "item water-fall-item" wx: for = "{{ array }}" style= "height:{{ item.h }}rpx;background:{{ item.b }}" >{{ item.v }}</view > </comp> |
2 在组件comp中:
index.wml
< view class = "water-fall-wrap" > < slot ></ slot > </ view > |
index.js
ready(){ const query = wx.createSelectorQuery(). in ( this ); query .selectAll( ".water-fall-item" ) .boundingClientRect( function (res) { console.log(res); }) .exec(); } |
自定义组件里面不能获取通过slot传入的元素节点是么?有什么方式可以获取么?
请问解决了吗