beforeEach是路由跳转前执行的,afterEach是路由跳转后执行的。

afterEach只有两个参数  afterEach((to,from)=>{})

例子:

router.afterEach((to,from)=>{
  if(to.path === "/news"){
    alert("进来news了哦");
  }
})

 

相关文章:

  • 2022-12-23
  • 2021-06-20
  • 2021-08-07
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2021-06-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
  • 2021-05-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案