Skip to content

dotneet/vue-event-bus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-event-bus

vue-event-bus helps Vue components to communicate with each others.

Install

npm install --save vue-event-bus

Setup

var VueEventBus = require('vue-event-bus')
Vue.use(VueEventBus)

Usage

new Vue({
  created: function () {
    this.$bus.$on('event', function () { console.log('event is received.') })
  }
})

new Vue({
  created: function () {
    this.$bus.$emit('event')
  }
})

Options

If you want to change the name of bus you can use name option.

Vue.use(VueEventBus,{name:'$eventbus'})

new Vue({
  created: function () {
    this.$eventbus.$emit('event')
  }
})

License

MIT

About

vue-event-bus helps Vue components to communicate with each others.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published