NervJS / taro

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
https://docs.taro.zone/
Other
35.34k stars 4.77k forks source link

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '$forceUpdate') #10989

Closed Mo-zixin closed 2 years ago

Mo-zixin commented 2 years ago

相关平台

H5

复现仓库

https://github.com/jdf2e/nutui-demo/tree/master/taro3 浏览器版本: Chrome 96.0.4664.110(正式版本) (64 位) 使用框架: Vue 3

复现步骤

安装依赖后 运行到h5

期望结果

显示页面

实际结果

vue3.ts?d42d:136 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '$forceUpdate') at Object.updateAppInstance (vue3.ts?d42d:136) at Object.mount (vue3.ts?d42d:127) at mount (common.ts?d785:127) at Object.onLoad (common.ts?d785:144) at PageHandler.load (index.js?ddae:3022) at _callee$ (index.js?ddae:3298) at tryCatch (runtime.js?96cf:62) at Generator.invoke [as _invoke] (runtime.js?96cf:296) at Generator.prototype. [as next]

环境信息

taro info
� Taro v3.3.18

  Taro CLI 3.3.18 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 14.18.1 - C:\WindowApps\Professional\nodejs\node.EXE
      Yarn: 1.22.15 - C:\WindowApps\Professional\yarn\bin\yarn.CMD
      npm: 6.14.15 - C:\WindowApps\Professional\nodejs\npm.CMD
Ttou commented 2 years ago

同样的问题,只在h5下报错,小程序好的

zhangcscc commented 2 years ago

image 同样的问题,请问如何解决?

strongyc commented 2 years ago

同样的问题,怎么解决呀

ZakaryCode commented 2 years ago

可以在 app.config 中配置 appId 临时修复

仅在 3.3.18 vue3 for h5 出现该问题,下一个版本修复

della526 commented 2 years ago

可以在 app.config 中配置 appId 临时修复

仅在 3.3.18 vue3 for h5 出现该问题,下一个版本修复

运行yarn dev:h5,浏览器直接报错。 app.config 中配置 appId 也没有用。难道是我配置错了?请问如何配置,可否截个图?浏览器还能识别 appId是否正确吗?有点无奈,刚准备学习taro,demo就跑不起来了。着急

ZakaryCode commented 2 years ago
// app.config.ts

export default {
+  appId: 'app',
  pages: [
    'pages/index/index',
    'pages/detail/index'
  ],
  window: {
    backgroundTextStyle: 'light',
    navigationBarBackgroundColor: '#fff',
    navigationBarTitleText: 'WeChat',
    navigationBarTextStyle: 'black'
  }
}
zhangcscc commented 2 years ago

感谢解答,在 app.config.ts 中添加了这个属性后可以正常运行了!

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2021年12月29日(星期三) 中午1:47 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [NervJS/taro] Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '$forceUpdate') (Issue #10989)

// app.config.ts export default { + appId: 'app', pages: [ 'pages/index/index', 'pages/detail/index' ], window: { backgroundTextStyle: 'light', navigationBarBackgroundColor: '#fff', navigationBarTitleText: 'WeChat', navigationBarTextStyle: 'black' } }

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: @.***>