在vue内,通过this访问。
使用方法与jq相似
1、监听事件,传入事件名称(event)和句柄(handle)
this.Eon(event, handle);
//this.Eon('add', this.add);
2、监听一次
this.Eonce(event, handle);
//this.Eonce('add', this.add);
3、取消监听,传入事件名称和句柄
this.Eoff(event, handle);
//this.Eoff('add', this.add);
4、触发事件,传入事件名称,需要传递参数时使用data
this.Etrigger(event, data);
//this.Etrigger('add', this.data);
//this.Etrigger('add', {msg:1});
5、匿名函数可以监听,但是无法取消监听。