首页 > 其他 > 详细

Vue路由参数设置可有可无

时间:2018-09-11 15:46:46      阅读:243      评论:0      收藏:0      [点我收藏+]

参数后面使用 ?

id 后面加个 ‘ ? ’ ,将 id 设置为可选参数

{
    name: "index",
    path: ‘/p/:id?‘,
    component: resolve =>void(require([‘../components/admin/layout/index.vue‘], resolve))
}
//  ==
{ path: ‘/p/:id?‘, name: ‘index‘, component: Index}

Vue路由参数设置可有可无

原文:https://www.cnblogs.com/huancheng/p/9627730.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!