带佬们,问问为什么不生效呢?
import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Login from '@/components/Login'
import Vuex from '@/components/Vuex.vue'
Vue.use(Router)
const router = new Router({});
export default new Router({
mode: 'history',
routes: [{
path: '/HelloWorld',
name: 'HelloWorld',
component: HelloWorld,
meta: {
requireAuth: true
}
},
{
path: '/',
name: 'Login',
component: Login
},
{
path: '/Vuex',
name: 'Vuex',
component: Vuex,
meta: {
requireAuth: true
}
}
]
})
router.beforeEach((to, from, next) => {
console.log("111111111")
next();
})