在父routes里面增加一个属性children,然后是一个数组,配置一个子路由,子路由的路径path不能有/,直接写路径名.
如chilidren:[path:"Student" component:Student ]
然后在使用router-link时to的路径要加上父路径
如<router-link to:"/School/Student"></router-link>
父路由配置子路由:无/路径实践与router-link用法
本文介绍了如何在父路由中使用children属性添加子路由,强调了子路由路径不包含'/',并展示了如何在router-link中正确指定到子路由的路径,包括添加父路径。
在父routes里面增加一个属性children,然后是一个数组,配置一个子路由,子路由的路径path不能有/,直接写路径名.
如chilidren:[path:"Student" component:Student ]
然后在使用router-link时to的路径要加上父路径
如<router-link to:"/School/Student"></router-link>
557

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