import Vue from 'vue' export const EventBus = new Vue() export default ({ app }) => { // 前置路由守卫 app.router.beforeEach((to, from, next) => { EventBus.$emit('beforeEach') next() }) // 后置路由守卫 app.router.afterEach((to, from) => { const whiteList = ['template-ross-activity-challenge'] if (whiteList.indexOf(to.name) > -1) return EventBus.$emit('afterEach') }) }