水绅 2022-03-30 11:59 采纳率: 83.3%
浏览 130
已结题

vue跳转后怎么刷新跳转后的页面

首页上有个按钮切换:

this.$router.push({ path: "/cutLogin" });

然后我在cutLogin页面点击跳到首页(我要切换到首页并刷新整个页面获取某些权限,provide /inject 这不行。)

this.$router.push({ path: "/index"})
 let aboutRoute = this.$route.fullPath
 if (aboutRoute == '/index') {
      window.location.reload(true);
}

这样写跳转后是刷新首页页面,但有问题,有时候aboutRoute 获取到的不是/index,是/cutLogin,这是为啥?

  • 写回答

3条回答 默认 最新

  • 你好!机器人 2022-03-30 12:16
    关注

    用window.location.href

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 4月7日
  • 已采纳回答 3月30日
  • 创建了问题 3月30日