Closed fangbicheng closed 1 year ago
@fangbicheng 小程序里不能这样写,请参考文档:https://docs.taro.zone/docs/ref#%E8%8E%B7%E5%8F%96%E8%8A%82%E7%82%B9%E5%B0%BA%E5%AF%B8%E4%BF%A1%E6%81%AF
https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.boundingClientRect.html 建议参考小程序文档里面的示例代码
或者像我这样封装
相关平台
微信小程序
小程序基础库: Taro3 使用框架: React
复现步骤
const el = document.getElementById('#inner') const res = await el.getBoundingClientRect()
期望结果
有值
实际结果
undefined
环境信息