0.1.0 • Published 3 years ago

vue-event-emitter v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

vue-event-emitter

为vue2.js设计的事件传播系列方法。

如何使用

首先,在你的js项目中进行安装:

npm install --save vue-event-emitter

安装完成以后引入并注册:

import eventEmitter from 'vue-event-emitter';

// 安装
Vue.use(eventEmitter);

然后,我们就可以在项目中使用了:

// 向上发射事件
this.$upEmitter(eventName:string,param:any);

// 向下发射事件
this.$downEmitter(eventName:string,param:any);

如果某个地方希望接受上面发射的事件,直接通过$on注册即可:

this.$on(eventName:string,param:any=>{
    // todo
});

开源协议

MIT

Copyright (c) 2021 hai2007 走一步,再走一步。