vue-plugin-eventhub
1.0.0 • Public • Published vue-plugin-eventhub (基于事件总线的封装)
安装
npm i vue-plugin-eventhub -S
引用
import vuePlugineventHub from 'vue-plugin-eventhub'
Vue.use(vuePlugineventHub)
Component A
new Vue({
methods: {
show(msg) {
console.log('show ' + msg);
}
},
events: {
hi(msg) {
console.log(msg);
},
sayHi: 'show'
}
events: [
function hi(msg) {
console.log(msg);
},
'show'
]
});
Component B
new Vue({
methods: {
show(msg) {
this.$trigger('hi', 'hello');
this.$trigger('sayHi', 'hello');
}
}
});
Readme
Keywords
nonePackage Sidebar
Install
npm i vue-plugin-eventhub
Weekly Downloads