const {ccclass, property} = cc._decorator;
@ccclass
export default class Helloworld extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
async start () {
// init logic
this.label.string = this.text;
this.label.string = await this.testAsync();
}
async testAsync() : Promise<string> {
return new Promise<string>((resolve, reject)=>{
setTimeout(() => {
resolve("liang miao yi hou ");
}, 2000);
});
}
}