路由代码
const router = new Router({
routes: [
{
path: '/',
name: 'LoginView',
component: LoginView,
beforeEnter: (to, from, next) => {
console.log('beforeEnter')
console.trace()
next()
}
},
]
})
组件component: LoginView的mounted
mounted () {
console.log('mounted')
console.trace()
},
控制台打印结果
其他组件生命周期和路由守卫带验证