1,<router-link :to></router-link> 传参
:to="`/detail/${item.id}/${index}/${item.number}`"
同时,route.js路由也要有相关的配置,
{
path: '/detail/:id/:index/:type',
name: 'detail',
component: detail
}
2,编程式导航传参:
(1) this.$router.push({
path:`/newList/`,
query:{
id:this.id
}
})
path 是路由配置项的路径,query就是需要传递的参数
(2) this.$router.push({ path: `/newList/${this.id}` })
取参: this.$route.params,切记使用this.$route.query是取不到的
来源:https://blog.csdn.net/qq_40319394/article/details/100084153