我想在Vue3中将一个值作为属性传递给一个视图。这种方法在Vue2项目中运行良好,但在Vue3中效果不佳
路由器:
{
path: "/view2",
name: "view2",
component: View2,
props: true
}视图1(来自)
navigateTo(){
this.$router.push({
name: view2,
params: {id: 'abc123'}
})
}视图2(至)
props:{
id:{
type: String,
required: false
}
}每次调用navigateTo()时,View2中都不会定义'id‘
我遗漏了什么,因为这在vue2项目中运行良好。
最好的
发布于 2019-10-03 09:53:06
您没有在路径中声明id。
{
path: "/view2/:id", // <----
name: "view2",
component: View2,
props: true
}https://stackoverflow.com/questions/58201409
复制相似问题