参考文章:https://blog.csdn.net/weixin_43836052/article/details/95166345
1.params 传参 : 相当于post请求,页面跳转时参数不会在地址栏中显示
this.$router.push({
name:' ',
params: { id:idParams }
})
接收参数:
this.$route.params.id
2.query 传参 : 相当于get请求,页面跳转时参数会在地址栏中显示
this.$router.push({
name:' ',
query: { id:idParams }
})
接收参数:
this.$route.query.id
注意:
name为在router下index.js里定义的,如:
{
path: '/',
name: 'sidebar',
component: sidebar
},