1、params 传参
this.$router.push({name: ‘…’, params: {id: …}})
params传参, 路径不能使用path 只能使用name,否则params将无效。
取数据: this.$route.params.id
2、query 传参
params传参, 路径可以使用path或者name
this. r o u t e r . p u s h ( p a t h : ′ . . . . . ′ , q u e r y : i d : . . . . . ) 取 数 据 : t h i s . router.push({path: '.....', query: {id: .....}}) 取数据: this. router.push(path:′.....′,query:id:.....)取数据:this.route.query.id
vue官方:
https://router.vuejs.org/zh/guide/essentials/passing-props.html#%E5%B8%83%E5%B0%94%E6%A8%A1%E5%BC%8F