参数后面使用 ?
id 后面加个 ‘ ? ’ ,将 id 设置为可选参数
{ name: "index", path: '/p/:id?', component: resolve =>void(require(['../components/admin/layout/index.vue'], resolve)) } // == { path: '/p/:id?', name: 'index', component: Index}