原理不清楚,记录一下
- 效果
点击哪个页面展示哪个 - 路由中
{
path: "/news",
name: "news",
children: [
{
path: "/news/:id",------------------------------------------这里固定
name: "newsId",---------------------------------------------这里命名随意
component: () => import("../components/news/NewsDetail.vue"),
},
],
component: () => import("../views/News.vue"),
},
- news
- NewsDetail中
- 然后这个是$route里面的内容