uniapp无法获取动态dom节点解决方案
1.需要在动态dom节点生成后再获取dom节点
2.在this.$nextTick()方法中获取dom节点
onShow(){
this.getPageList().then(()=>{ //this.getPageList是我生成动态dom节点方法
this.$nextTick(function(){
const query = uni.createSelectorQuery().in(this);
//获取多个节点方式
query.selectAll(".doBox").boundingClientRect(data=>{
console.log('获取多个dom节点:',data)
}).exec();
//获取单个节点方式
query.select(".doBox").boundingClientRect(data=>{
console.log('获取单个dom节点:',data)
}).exec();
})
})
}