vue-auto-bus
v0.0.1
Published
A simple global event bus tool for Vue2.
Downloads
4
Readme
About
A simple global event bus tool for Vue2. This tool will delete all relevant events when Vue object is destoryed.
usage
var vab=require('vue-auto-bus');
Vue.use(vab);
In your-single.vue file:
export default {
mounted(){
//any where in vue file
//listen
this.$bus.on('your-event-name',()=>{
// do something
})
// send event
this.$bus.emit('your-event-name','anything')
},
// or
$bus:{
}
}
TODO
- test case
- more document
- bus helper