beforeEach 不会触发?

import Vue from ‘vue’
import Router from ‘vue-router’
import HelloWorld from ‘@/components/HelloWorld’

Vue.use(Router)
const router = new Router({});
export default new Router({
routes: [
{
path: ‘/’,
name: ‘HelloWorld’,
component: HelloWorld
}
]
})

router.beforeEach((to, from, next) => {

console.log(“111111111”)
next();

})

你export的是一个新的Router实例,而你定义的router并没有导出去。