第一种
路由配置
path: "/index/:id",
name: "Index",
component: () => import("../views/index.vue"),
跳转页面调用
this.$router.push({
path: '/index/${id}'
})
获取参数的方法
this.$route.params.id
第二种
路由配置
{
path: '/index',
name: 'Index'
}
跳转页面调用
this.$router.push({
name: 'Index',
params: {
id: id
}
})
获取参数的方法
this.$route.params.id