Home  >  Q&A  >  body text

javascript - vue-router route jumps to other addresses, how to not keep history records

Page routing is configured with two

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

First jump from index to detail, detail then jump to other addresses such as Baidu or something, and then click return on WeChat. How to return directly to the first page?

为情所困为情所困2713 days ago974

reply all(3)I'll reply

  • 天蓬老师

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

    After jumping to Baidu, it will no longer be under your control.
    You can determine whether the document.referrer is for another URL in your routing or component. If so, return to the first page.

    reply
    0
  • 伊谢尔伦

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

    window.location.replace()

    reply
    0
  • 天蓬老师

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

    this.$router.replace()

    reply
    0
  • Cancelreply