HarmonyOS 在Page内使用方法调用方法异常
遇到一个奇怪的问题,在一个方法内调用另外一个方法,如果写this.showDialog无法调用,如果写this.showDialog(),则会抛异常:Error message:is not callableSourceCode:this.shoDialog();^
代码如下:
import { CommonButton } from '../components/CommonButton';
import { loadingDialog } from '../components/LoadingDialog';
import promptAction from '@ohos.promptAction'
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
showDialog(){
promptAction.openCustomDialog({
builder: loadingDialog.bind(this,'测试中.....'),
isModal: false
}).then((dialogId: number) => {
this.loadingDialogId = dialogId
})
}
onClickBtn() {
//问题点
this.showDialog
}
build() {
Row() {
CommonButton({
onClickEvent: this.onClickBtn
}).height(48)
.enabled(true)
.width('100%')
}
.height('100%')
}
loadingDialogId: number = 0;
}
HarmonyOS
赞
收藏 0
回答 1
待解决
相关问题
HarmonyOS har 模块内router 的正确使用方法
304浏览 • 1回复 待解决
touchEvent的使用方法
7187浏览 • 1回复 待解决
HarmonyOS AsyncCallback的使用方法
1503浏览 • 1回复 待解决
HarmonyOS 关于AOP具体使用方法
910浏览 • 1回复 待解决
日志工具类的使用方法
872浏览 • 1回复 待解决
RSA 加密的具体使用方法
656浏览 • 1回复 待解决
HarmonyOS 自定义回调中this指向问题,无法调用Page内方法
292浏览 • 1回复 待解决
HarmonyOS vp的含义及使用方法?
389浏览 • 1回复 待解决
HarmonyOS .ets文件中不能使用方法重载
269浏览 • 1回复 待解决
HarmonyOS NODE_ALIGN_SELF使用方法描述有误
779浏览 • 1回复 待解决
#鸿蒙通关秘籍#KCP协议在OpenHarmony中的接口使用方法详解
497浏览 • 1回复 待解决
HarmonyOS 如何直接调用内部page或者组件的方法
266浏览 • 1回复 待解决
#鸿蒙通关秘籍#鸿蒙栅格布局容器的使用方法
337浏览 • 1回复 待解决
HarmonyOS 有像 Vue 一样的插槽使用方法吗
306浏览 • 1回复 待解决
#鸿蒙通关秘籍#HarmonyOS应用中Icon图标的使用方法
537浏览 • 2回复 待解决
系统日历方法使用会抛异常
824浏览 • 0回复 待解决
HarmonyOS 有没有具体文档介绍vp的含义及使用方法?
337浏览 • 1回复 待解决
HarmonyOS ComposeListItem使用switch监听onChange方法变化异常
331浏览 • 1回复 待解决
HarmonyOS组件嵌入flutter页面 OhosView的使用方法及HarmonyOS端实现
688浏览 • 1回复 待解决
在应用内监听手机熄屏的方法
1138浏览 • 1回复 待解决
ArkTs在Page页内,如何关闭当前Page页?
3334浏览 • 1回复 待解决
使用BuilderParam在父组件调用this的方法报错:Error message:is not callable
2200浏览 • 1回复 待解决
HarmonyOS 测试设备调用应用内支付返回异常
1069浏览 • 1回复 待解决
HarmonyOS 单例模式打开已有page,page执行什么方法
240浏览 • 1回复 待解决
使用 @Builder注解,自定义方法参考链接:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-builder-V5
参考demo: