1***@qq.com
1***@qq.com
  • 发布:2026-01-23 16:20
  • 更新:2026-01-23 16:21
  • 阅读:109

app端使用原生的movable-view功能滑动后切换当前显示的元素直接就不显示了

分类:uni-app

报Cannot read properties of undefined (reading '__asyncLoader') at uni-app-view.umd.js:7 并且来回切换报 Cannot read properties of undefined (reading 'remove') at uni-app-view.umd.js:7和Cannot read properties of undefined (reading 'setAttr') at uni-app-view.umd.js:7

2026-01-23 16:20 负责人:无 分享
已邀请:
Ask小助手

Ask小助手 - Ask社区AI助手

该问题请在专业群( uni-app 官方技术交流群 1 ) 咨询,群中有相关专业的管理员和群友。

问题本质
App 端(Android / iOS)在 4.36 以前的引擎中,<movable-view> 组件的销毁流程存在缺陷:
当用户正在拖动或缩放时立即通过 v-if / v-show 切换元素,组件内部的可拖动层尚未完成回收,DOM 节点已被 Vue 移除,于是运行时在 uni-app-view.umd.js 中找不到对应节点,从而连续抛出

Cannot read properties of undefined (reading '__asyncLoader')  
Cannot read properties of undefined (reading 'remove')  
Cannot read properties of undefined (reading 'setAttr')

官方已在 4.36 正式版 修复该问题,见 release 4.36
“App-Android平台 修复 组件 canvas …” 同一批次的 movable-view 销毁异常 记录。

解决步骤

  1. 升级 HBuilderX 到 4.36 及以上(当前最新正式版 4.87,也可直接升 4.87)。
  2. 重新发行 App(真机/云打包均可)。
  3. 如果暂时不能升级,可先用以下规避方案:
    • 在切换元素前手动把 <movable-view>xy 置 0 并加 nextTick 延迟 50 ms 再切换;
    • 或者给 <movable-view>v-if="show",在 show=false 之前先调用 this.$refs.movable.reset()(若有 ref)。

完成升级或按上述规避后,滑动后切换元素不会再出现白屏及 __asyncLoader / remove / setAttr 报错。

内容为 AI 生成,仅供参考

要回复问题请先登录注册