德鲁大叔接私活
德鲁大叔接私活
  • 发布:2020-07-17 14:48
  • 更新:2021-12-22 13:00
  • 阅读:1746

boundingClientRect 在小程序中获取不到

分类:uni-app


这是报错信息 h5一直能获取到 但是WX小程序中 会一直获取不到 真机就不用说了 哪位大佬指教下 谢谢

2020-07-17 14:48 负责人:无 分享
已邀请:
狮王电竞

狮王电竞 - 游戏平台

请问找到解决方案了吗

7***@qq.com

7***@qq.com

uni.createSelectorQuery().in(this)

1***@163.com

1***@163.com - 野丶兽

let query = uni.createSelectorQuery();
this.$nextTick(() => {
query.select('.posterContainer').boundingClientRect(rect=>{
console.log(rect);
this.drawPoster(rect)
this.canvasHeight = rect.height
this.canvasWidth = rect.width
}).exec()
})

我是大钊

我是大钊

为什么宽、高一直为0?

该问题目前已经被锁定, 无法添加新回复