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})

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM