0
我希望能夠獲得我分配的所有參考文獻的measure()
。這就是我想要管理的內容:是否可以將參數放入數組中?
<View
ref="dropZone[]">
</View>
<View
ref="dropZone[]">
</View>
lets dropZones = []
for(let i=0; i < refs.length; i++){
this.refs[i].measure((ox, oy, width, height, px, py) => {
dropZones.push({x: px, y:py, height: height, width: width})
}
}
什麼是最好的管理方式?
是否行得通?如果它有效 - 它是「最好的」,否則它不是。 – zerkms
我只是試圖用這種方式展示一個例子。甚至可以在道具中聲明一個數組? –
這是可能的 - https://facebook.github.io/react/docs/refs-and-the-dom.html – zerkms