首頁  >  問答  >  主體

javascript - vue-router路由跳到其他位址,如何不保留歷史記錄

頁面路由配置了兩個

{
  path: 'index',
  name: 'introduce',
  component: page.introduce,
},
{
  path: 'detail',
  name: 'detail',
  component: page.detail,
}

由先由index跳到detail, detail再跳轉其他地址如百度或什麼的,再點擊微信端的返回,如何直接返回到第一個頁面?

为情所困为情所困2713 天前971

全部回覆(3)我來回復

  • 天蓬老师

    天蓬老师2017-05-16 13:44:06

    跳到百度之後就不歸你管了.
    可以在你的路由或元件裡面判斷do​​cument.referrer是不是為其他網址.是的話回傳第一個頁.

    回覆
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 13:44:06

    window.location.replace()

    回覆
    0
  • 天蓬老师

    天蓬老师2017-05-16 13:44:06

    這個.$router.replace()

    回覆
    0
  • 取消回覆