From 55a2deace8176231a3957aa2ead0b2631d0c870f Mon Sep 17 00:00:00 2001 From: Revantant Date: Thu, 11 Jul 2019 15:50:53 +0800 Subject: [PATCH] feat import routes --- mock/route.js | 10 +++++++ src/api/route.js | 8 ++++++ src/router/index.js | 9 +++++++ src/views/permission/route.vue | 49 ++++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 src/views/permission/route.vue diff --git a/mock/route.js b/mock/route.js index d36c6fcc..38cd2e97 100644 --- a/mock/route.js +++ b/mock/route.js @@ -33,5 +33,15 @@ export default [ data: asyncRoutesMap } } + }, + { + url: '/routes', + type: 'put', + response: _ => { + return { + code: 20000, + data: {} + } + } } ] diff --git a/src/api/route.js b/src/api/route.js index 8cd35e69..9891b64d 100644 --- a/src/api/route.js +++ b/src/api/route.js @@ -6,3 +6,11 @@ export function getRoutes() { method: 'get' }) } + +export function importRoutes(data) { + return request({ + url: '/routes', + method: 'put', + data + }) +} diff --git a/src/router/index.js b/src/router/index.js index fbe8ad25..559de4fd 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -167,6 +167,15 @@ export const asyncRoutes = [ title: 'Role Permission', roles: ['admin'] } + }, + { + path: 'path', + component: () => import('@/views/permission/route'), + name: 'Route', + meta: { + title: 'Route', + roles: ['admin'] + } } ] }, diff --git a/src/views/permission/route.vue b/src/views/permission/route.vue new file mode 100644 index 00000000..8909b6f0 --- /dev/null +++ b/src/views/permission/route.vue @@ -0,0 +1,49 @@ + + + +