diff --git a/mock/route.js b/mock/route.js index 38cd2e97..1934ec47 100644 --- a/mock/route.js +++ b/mock/route.js @@ -19,6 +19,14 @@ const mapAsyncRoutes = asyncRoutes => { return tmp }) } +const mapRouteId = routes => { + return routes.map(route => { + const tmp = { ...route } + tmp.id = Math.random() + tmp.children && tmp.children.length && (tmp.children = mapRouteId(tmp.children)) + return tmp + }) +} const asyncRoutesMap = mapAsyncRoutes(asyncRoutes) export { asyncRoutesMap as routes } @@ -30,7 +38,7 @@ export default [ response: _ => { return { code: 20000, - data: asyncRoutesMap + data: mapRouteId(asyncRoutesMap) } } }, diff --git a/src/views/permission/route.vue b/src/views/permission/route.vue index 2c5ddbba..577df344 100644 --- a/src/views/permission/route.vue +++ b/src/views/permission/route.vue @@ -2,7 +2,7 @@