ricardovfreixo / vue-event-bus

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

License:MIT License


Languages

Language:JavaScript 60.7%Language:HTML 39.3%