原理不清楚,記錄一下
- 效果
點選哪個頁面展示哪個 - 路由中
{
path: "/news",
name: "news",
children: [
{
path: "/news/:id",------------------------------------------這裡固定
name: "newsId",---------------------------------------------這裡命名隨意
component: () => import("../components/news/NewsDetail.vue"),
},
],
component: () => import("../views/News.vue"),
},
- news
- NewsDetail中
- 然後這個是$route裡面的內容