HarmonyOS Cannot read property observeComponentCreation2 of undefined
Cannot read property observeComponentCreation2 of undefined
@Builder 
alertBuilder() { 
  Column() { 
 
    Text("欢迎使用abcd").fontSize(17).fontWeight(FontWeight.Medium).margin({top:32}) 
    // Blank("16") 
    Scroll(){ 
      Text(this.desc).fontSize(17).fontWeight(FontWeight.Regular) 
    }.height(199).width("80%") 
    // Blank("19") 
    Button("不同意").backgroundColor(Color.Transparent).fontColor(0x0000000) 
    // Blank("7") 
    Button("同意").backgroundColor(Color.Orange).borderRadius(20).width("80%").margin({bottom:24}).onClick( 
      () => { 
        router.replaceUrl({ 
          url: CommonConstants.MAIN_PAGE_URL 
        }); 
      } 
    ) 
    // Blank() 
 
  } 
}
        HarmonyOS
      
        赞
        
 收藏 0
 回答 1
 
        待解决
        
相关问题
 HarmonyOS Cannot read property setMissionContinueState of undefined 
1333浏览  • 1回复 待解决
HarmonyOS代码报错 cannot read property aboutToRender of undefined 
1816浏览  • 1回复 待解决
HarmonyOS 调试报错TypeError:Cannot read property xxx of undefined 
3796浏览  • 1回复 待解决
Cannot read property mediaUris of undefined怎么回事啊? 
1762浏览  • 1回复 待解决
HarmonyOS Cannot set property when setter is undefined 
1288浏览  • 1回复 待解决
升级RN到4.1.0.300版本之后运行报错Error message:Cannot read property isDebugModeEnabled of undefined 
2331浏览  • 1回复 待解决
项目编译报错TypeError: Cannot read properties of undefined (reading 'newFileToResourceList') 
3435浏览  • 1回复 待解决
升级IDE后编译报错:hvigor ERROR: Error: TypeError, Cannot read properties of undefined (reading 'getParameter 
2796浏览  • 1回复 待解决
duplicate @Provide property with name userInfo. 
2875浏览  • 1回复 待解决
HarmonyOS Cannot find name 'ESObject' 
1544浏览  • 1回复 待解决
HarmonyOS  READ_IMAGEVIDEO权限问题 
1876浏览  • 1回复 待解决
HarmonyOS List提示undefined 
762浏览  • 1回复 待解决
启动UIAbility时报“must have required property 'startWindowIcon'”错误 
2945浏览  • 1回复 待解决
HarmonyOS Object is possibly 'undefined'. <ArkTSCheck>报错 
1785浏览  • 1回复 待解决
HarmonyOS UIAbilityContext.openLink 为 undefined 
1110浏览  • 1回复 待解决
报错Property 'pushUrl' does not exist on type 'typeof router'. 
5372浏览  • 1回复 待解决
HarmonyOS创建前置广角相机返回undefined 
1059浏览  • 1回复 待解决
HarmonyOS SourceTool.xxx值为undefined 
1226浏览  • 1回复 待解决
getContext 提示错误,Cannot find name 'getContext' 
2275浏览  • 1回复 待解决
使用fetch报错,fetch undefined 
8563浏览  • 2回复 待解决
HarmonyOS ohos.permission.READ_MEDIA权限废弃问题 
1511浏览  • 1回复 待解决





















在builder后使用bind(this),再次尝试。如下promptAction.openCustomDialog({builder:this.alertBuilder.bind(this)})
可参考文档:
https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-promptaction-V5