我有一个父组件 A ,父组件里面的子组件 B 直接显示在父组件的 template 里面上:
A.vue:
<template>
...
...
<b/>
</template>
import B from B.vue
setup(){
components: {B}
}
在路由里面,是这么写的:
{
path: "/A_path",
name: "A",
components: {
header: Header,
main: A,
},
children: [{
path: "B_path/:id",
component: B,
},],
},
可以看到,在 B 的路由里面,有一个参数 id
但问题是,我的 B 直接在 A 组件下面显示了,那么这个 id 是怎样才能传递进去呢?