const {ccclass, property} = cc._decorator;
@ccclass
export default class TestButton extends cc.Component{
private _button:cc.Button=null;
protected onLoad():void{
super.onLoad();
this._button=this.getComponent(cc.Button);
let eventandler=new cc.Component.EventHandler();
eventHandler.target=this.node;
//eventHandler.component=TestButton.name;
eventHandler.component=this.constructor.name;
eventHandler.handler="onClick";
eventHandler.customEventData="my data";
this._button.clickEvents.push(eventHandler);
}
private onClick(event:cc.Event.EventTouch,customData:any):void{
}
}