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);
var eventHandler=new cc.Component.EventHandler();
eventHandler.target=this.node;
eventHandler.component="TestButton";
eventHandler.handler="onClick";
eventHandler.customEventData="my data";
this._button.clickEvents.push(eventHandler);
}
private onClick(event:cc.Event.EventTouch,customData:any):void{
}
}