HarmonyOS getContext\(\)获取不到?

如题:HarmonyOS getContext()获取不到?

阅读 572
1 个回答

问题场景

在两个不同的页面分别使用bindPopup与bindSheet弹出相同的弹窗,点击弹窗中的按钮跳转H5页面,其中bindPopup会闪退,报错Error message:Cannot read property resourceManager of undefined SourceCode:const resourceManager = context.resourceManager; getContext()获取不到。而bindSheet正常打开h5页面

getContext()获取不到,导致resourceManager 为undefined

在ability内使用this.context

在ui侧可使用getcontext

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进