1、router/index.js
{undefined
path:'/mtindex',
component: mtindex,
//添加路由
children:[
{undefined
path:':shopid',
component:guessdetail
}
]
},
2、传参数
this.$router.push({undefined
path: '/mtindex/detail', query:{shopid: item.id}
});
3、获取参数
this.$route.query.shopid
4、url的表现形式(url中带有参数)
javascripthttp://localhost:8080/#/mtindex/detail?shopid=1
本文介绍了如何在Vue应用中使用router/index.js配置动态路由,并通过实例展示了如何通过$router.push()传递参数以及如何在组件中获取这些参数。详细讲解了URL中包含参数的表示形式和关键操作。

2591

被折叠的 条评论
为什么被折叠?



