router.beforeEach((to,from,next)=>{ //从from跳转到to document.title=to.matched[0].meta.title console.log(to) next() //这步必须要调用 })
//后置钩子 router.afterEach((to,from)=>{ //从from跳转到to document.title=to.matched[0].meta.title console.log(to) //这个函数不需要调用next })