Skip to content

Cweili/vue-option-events

Repository files navigation

vue-option-events

npmbundle sizenpm downloadslicense

githubbuildcoverage

Bring Vue.js 1 events option and $emit to Vue.js 2.

Install

npm install vue-option-events --save 

Basic Usage

Install plugin

importVuefrom'vue';importvueOptionEventsfrom'vue-option-events';Vue.use(vueOptionEvents);

Set events option

Component A

newVue({methods: {show(hiMessage){console.log(hiMessage);}},events: {hello(helloMessage){console.log(helloMessage);},hi: 'show'}});

Component B

newVue({methods: {send(){this.$emit('hello','world');this.$emit('hi','world');}}});

Use as global event bus

newVue({methods: {send(){this.$event.$emit('hello','world');}}});

Emit events from any where

importeventBusfrom'vue-option-events';eventBus.$emit('hello','world');

Options

Vue.use(vueOptionEvents,{keepAlive: false});

About

Bring Vue.js 1 events option and $emit to Vue.js 2.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •