vue-event-emitter

0.1.0 • Public • Published

vue-event-emitter

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

downloads install size CDN Version License GitHub repo stars

如何使用

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

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 走一步,再走一步。

Readme

Keywords

Package Sidebar

Install

npm i vue-event-emitter

Weekly Downloads

3

Version

0.1.0

License

MIT

Unpacked Size

6.26 kB

Total Files

7

Last publish

Collaborators

  • hai2007