栉风
栉风
  • 发布:2024-01-26 14:36
  • 更新:2024-01-27 11:18
  • 阅读:251

这个报错是onResize的原因吗?

分类:uni-app

报错信息:

on-error TypeError: Cannot read properties of null (reading 'offsetWidth')  
    at uni-h5.es.js:7052:25  
    at callWithErrorHandling (vue.runtime.esm.js:1375:22)  
    at callWithAsyncErrorHandling (vue.runtime.esm.js:1384:21)  
    at HTMLDivElement.invoker (vue.runtime.esm.js:9729:9) object {}

uni-h5.es.js:7052:25:

function useResizeSensorUpdate(rootRef, emit2, reset) {  
  const size = reactive({  
    width: -1,  
    height: -1  
  });  
  watch(() => extend({}, size), (value) => emit2("resize", value));  
  return () => {  
    const rootEl = rootRef.value;  
    size.width = rootEl.offsetWidth;  
    size.height = rootEl.offsetHeight;  
    reset();  
  };  
}
2024-01-26 14:36 负责人:无 分享
已邀请:
YUANRJ

YUANRJ

请提供下测试工程

要回复问题请先登录注册