错误提示:Please do not specifiy “default” attribute in decorator of “text” property in “SuperClass” class.
const {ccclass, property, executionOrder} = cc._decorator;
@ccclass
@executionOrder(1)
export default class SuperClass extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property({
default: 'hello'
})
text: string;
async onLoad() {
// init logic
this.label.string = await this.testAsync();
}
protected async testAsync(): Promise<string> {
return new Promise<string>((resolve, reject) => {
setTimeout(() => {
resolve("Hello, World!");
}, 1000)
})
}
}
CocosCreator v1.6.1
typescript v2.4.2
node v6.9.5
备份:http://forum.cocos.com/t/1-5-0-beta2-typescript-propery-bug/45851