{
"errCode": "00000000",
"errMsg": "SUCCESS",
"timestamp": "1559127780939",
"transId": "",
"body": {
"router": [
{
"path": "''",
"component": "Layout",
"redirect": "'/home'",
"meta": {
"title": "title",
"icon": "icon"
},
"children": [
{
"path": "path",
"name": "name",
"component": "() => import('@/views/home/index')",
"meta": {
"title": "title",
"icon": "icon"
}
},
{
"path": "path",
"name": "name",
"component": "() => import('@/views/home/index')",
"meta": {
"title": "title",
"icon": "icon"
}
}
]
},
{
"path": "''",
"component": "Layout",
"redirect": "'/home'",
"meta": {
"title": "title",
"icon": "icon"
},
"children": [
{
"path": "path",
"name": "name",
"component": "() => import('@/views/home/index')",
"meta": {
"title": "title",
"icon": "icon"
}
},
{
"path": "path",
"name": "name",
"component": "() => import('@/views/home/index')",
"meta": {
"title": "title",
"icon": "icon"
}
}
]
}
]
}
}
如path:"''" ,component:"() => import('@/views/home/index')"以及redirect:"'/home'",去掉最外层双引号,这个需要怎么去遍历循环呢
过滤成以下格式:
{
path: '',
component: Layout,
redirect: '/home',
children: [{
path: 'home',
name: 'Home',
component: () => import('@/views/home/index'),
meta: {title: '首页', icon: 'home', headerText: '首页', }
}]
}
new Function()和eval()都可以实现 推荐用new Function