在resume Event我必须调用此方法 this.callResume()
. 当我'm calling that method I'm收到运行时错误:
TypeError:this.callResume不是函数
我不知道如何从生命周期中的resume方法调用方法 . 我在构造函数中放置了resume方法 .
constructor() {
applicationOn(resumeEvent, function (args: ApplicationEventData) {
if (args.android) {
// For Android applications, args.android is an android activity class.
console.log("Activity: " + args.android);
this.callResume();
} else if (args.ios) {
// For iOS applications, args.ios is UIApplication.
console.log("UIApplication: " + args.ios);
}
});
}
callResume():void{
console.log("ResumeCalled", "Test");
}
1 回答
使用tte箭头函数表示法
()=>
而不是function
. 将您的代码更改为以下内容: