Vue中this.$router.push参数获取方法

(编辑:jimmy 日期: 2025/5/4 浏览:2)

传递参数的方法:

1.Params

由于动态路由也是传递params的,所以在 this.$router.push() 方法中path不能和params一起使用,否则params将无效。需要用name来指定页面。

及通过路由配置的name属性访问

在路由配置文件中定义参数:

Vue中this.$router.push参数获取方法 

通过name获取页面,传递params:

Vue中this.$router.push参数获取方法 

在目标页面通过this.$route.params获取参数:

Vue中this.$router.push参数获取方法 

2.Query

页面通过path和query传递参数,该实例中row为某行表格数据

Vue中this.$router.push参数获取方法

在目标页面通过this.$route.query获取参数:

this.$route.query.row.xxx

以上这篇Vue中this.$router.push参数获取方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

一句话新闻

Windows上运行安卓你用过了吗
在去年的5月23日,借助Intel Bridge Technology以及Intel Celadon两项技术的驱动,Intel为PC用户带来了Android On Windows(AOW)平台,并携手国内软件公司腾讯共同推出了腾讯应用宝电脑版,将Windows与安卓两大生态进行了融合,PC的使用体验随即被带入到了一个全新的阶段。