vue中this.$router.push() 传参

157 阅读1分钟

vue中this.$router.push() 传参 1 params 传参

注意⚠️:patams传参 ,路径不能使用path 只能使用name,不然获取不到传的数据

name为router路由中定义的name

this.$router.push({name: 'dispatch', params: {paicheNo: obj.paicheNo}})

取数据:this.$route.params.paicheNo

this.$route.params.paicheNo

2 query传参

this.$router.push({path: '/transport/dispatch', query: {paicheNo: obj.paicheNo}})

取数据:this.$route.query.paicheNo

this.$route.query.paicheNo


总有一天你想要的东西都会像你迎来

原文 参考地址1 参考地址2