[LayaAir3]button组件的on() 触发点击事件和回调函数时报错
报错信息:
TypeError: Cannot read properties of null (reading 'on')
代码如下:
onEnable(): void {
this.button = this.owner.getChildByName("Button") as Button;
this.button.on(Laya.Event.CLICK, () => {
console.log("开始游戏");
})
}
TypeError: Cannot read properties of null (reading 'on')
代码如下:
onEnable(): void {
this.button = this.owner.getChildByName("Button") as Button;
this.button.on(Laya.Event.CLICK, () => {
console.log("开始游戏");
})
}
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
layaAir小孟
赞同来自: