const routes = [
{
path:'/',
component: Home
},
{
path: '/about',
component: About
},
{
path: '/user/:id',
component: User
},
{
//参数为数字
// path: '/news/:id(\\d+)',
// //有多个参数
// path: '/news/:id+',
//参数可有可无
// path: '/news/:id*',
// path: '/news/:id?',
component: NotFound
}
]
利用正则表达式