/** * 描述:事件总线帮助工具 * @ClassName eventBus * @Author apple * @Date 2019-04-20 19:58 * @Version 1.0 */ const EventBus = (Vue) => { Vue.prototype.$bus = new Vue({ methods: { on(event, ...args) { this.$on(event, args) }, once(event, ...args) { this.$once(event, args) }, emit(event, callback) { this.$emit(event, callback) }, off(event, callback) { this.$off(event, callback) } } }) } export default EventBus