useDidShow(() => {
//根据元素高度计算mask位置和高度
setTimeout(()=>{
Taro.createSelectorQuery()
.select('.sp-nav-filter')
.boundingClientRect((res) => {
console.log('boundingClientRect:', res)
if (res) {
setState(v=>{
v.offsetHight = res.top + res.height
})
}
})
.exec()
},1000)
});
Taro获取dom,拿到dom位置
最新推荐文章于 2024-06-07 23:26:45 发布