Taro.createSelectorQuery().select('#inbox').boundingClientRect(function (rect) {
console.log('in rect:', rect)
let width = rect.width
this.setState({
inWidth: width
})
}).exec()
<View id="outbox"></View>
在H5端正常,在小程序端报错
thirdScriptError
Cannot read property 'width' of null;at SelectorQuery callback function
TypeError: Cannot read property 'width' of null