Files
vis389/src/utils/eventBus.js
2021-12-28 18:11:34 +08:00

18 lines
365 B
JavaScript

// units/bus.js
const install = Vue => {
const Bus = new Vue({
methods: {
on(event, ...args) {
this.$on(event, ...args);
},
emit(event, callback) {
this.$emit(event, callback);
},
off(event, callback) {
this.$off(event, callback);
}
}
});
Vue.prototype.$bus = Bus;
};
export default install;