vue的push和replace跳转

1. push会添加一条history记录

2. replace会替换掉当前的history记录

      _this.$router.push({
        path: "/new-message",
        query: {
          appid: _this.authorizer_appid
        }
      });


      this.$router.replace({
        path: '/authorize-thirdparty',
        query: {
          curTab: 2
        }
      })

3. push在加上replace: true后,它不会向 history 添加新记录,而是跟它的方法名一样 —— 替换掉当前的 history 记录。

//push方法也可以传replace
this.$router.push({path: '/home', replace: true})

 

posted on 2020-05-15 17:37  活在当下zql  阅读(1864)  评论(0)    收藏  举报