跳转页面拼接多个参数_vue中动态路由的跳转(name | path)&& 前进后退 && replace

去到新的页面前进后退 methods: {        tiaozhuan(){        // this.$router.push({name:'me'})  //组件name跳转        // this.$router.push({path:'/me/text'}) //组件path跳转        // this.$router.push({name:'weather',params:{city:'北京'}})          //组件name跳转 带参数 如果使用name路由并且需要传递参数,需要搭配params一起        // this.$router.push({path:'/weather/天津',params:{city:'北京'}})          //天津  两种参数都存在的时候,path中的参数会起作用        // this.$router.push({path:'/weather/北京?username=jia&password=123456'})  //传值        this.$router.push({path:'/weather/牡丹江',query:{username:'jiajia',password:123456}})        //传值 分开写会自动拼接到path中                // this.$router.replace({path:'/weather/牡丹江',query:{username:'jiajia',password:123456}},()=>{        //     console.log('成功替换了页面,replace有回调函数')        // })  //去到了path页面后,不能回退到上一个页面,回退的只能是浏览器标签页        // console.log(this)         },         go(){            this.$router.go(1)//前进 数字可根据情况定义 history不够的话,是失败的        },        back(){            this.$router.go(-1)//后退        }    },
fbb9e7f3850b7d0baa7b8cc94ffc1073.png
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值