zoukankan      html  css  js  c++  java
  • vue 之this.$router.push、replace、go的区别

    this.$router.push  : 跳转到指定URL,向history栈添加一个新的记录,点击后退会返回至上一个页面

    使用:

    this.$router.push('/index')
    this.$router.push({path:'/index'})
    this.$router.push({path:'/index',query:{name: '123'}})
    this.$router.push({name:'index',params:{name:'123'}})

    this.$router.replace:跳转到指定URL,替换history栈中最后一个记录,点击后退会返回至上上一个页面

    使用:同push

    this.$router.go(n):类似window.history.go(n),向前或向后跳转n个页面,n可正(先后跳转)可负(向前跳转)

    使用:

    this.$router.go(1)    //类似history.forward()
     
    this.$router.go(-1)   //类似history.back()
  • 相关阅读:
    CF492B
    CF570B
    CF401C
    CF1190B
    CF413C
    CF486B
    CF976B
    NOIP 2020 解题报告
    状态压缩DP
    区间DP
  • 原文地址:https://www.cnblogs.com/zjz666/p/13445892.html
Copyright © 2011-2022 走看看