码迷,mamicode.com
首页 > 其他好文 > 详细

Vue路由参数设置可有可无

时间:2018-09-11 16:10:01      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:pretty   void   string   resolve   component   asc   uil   参数   min   

参数后面使用 ?

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路由参数设置可有可无

标签:pretty   void   string   resolve   component   asc   uil   参数   min   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!