Taro 3 createSelectorQuery获取元素为null
-
Taro2 中以下代码能成功获取到页面元素(image-cropper是个View)
componentDidMount() { const query = Taro.createSelectorQuery().in(this.$scope); query .select('.image-cropper') .boundingClientRect((rec) => { console.log('rec', rec); this.windowHeight = rec.height; this.windowWidth = rec.width; this.setCutCenter(); this.initialImg(); this.initCanvas(); }) .exec() }
升级到Taro3,this.$scope是undefined,根据这个issue,似乎Taro3不需要传this.$scope https://github.com/NervJS/taro/issues/6898
但是我把this.$scope删掉还是打印rec是null,求教taro3应该如何获取页面原生dom?