vue-options-events
1.1.0 • Public • Published vue-options-events (基于事件总线的封装)
安装
npm i vue-options-events -S
引用
import vueOptionsEvents from 'vue-options-events'
Vue.use(vueOptionsEvents)
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');
}
}
});
Package Sidebar
Install
Weekly Downloads