1、创建内嵌子路由,你需要添加一个vue文件,同时添加一个与该文件同名的目录用来存放子视图组件。
2、在父组件(.vue)内增加用于显示子视图内容
pages\index_id.vue
{
path: "/",
component: _56a4a1e7,
name: "index",
children: [{
path: ":id?",
component: _0e5705e3,
name: "index-id"
}]
},
id?说明id参数是非必传,如果想要id必传,在对应目录下新建index.vue
对应的新生成的路由:
{
path: "/",
component: _56a4a1e7,
children: [{
path: "",
component: _049610bb,
name: "index"
}, {
path: ":id",
component: _0e5705e3,
name: "index-id"
}]
},