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
})

 

相关文章:

  • 2022-12-23
  • 2021-12-31
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2021-08-03
  • 2021-05-17
猜你喜欢
  • 2022-12-23
  • 2021-09-28
  • 2021-04-23
  • 2021-08-07
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案