Showing
2 changed files
with
4 additions
and
2 deletions
| ... | @@ -3,7 +3,9 @@ export function createProxy(prefix, target) { | ... | @@ -3,7 +3,9 @@ export function createProxy(prefix, target) { |
| 3 | ret[prefix] = { | 3 | ret[prefix] = { |
| 4 | target, | 4 | target, |
| 5 | changeOrigin: true, | 5 | changeOrigin: true, |
| 6 | + ws: true, | ||
| 6 | // rewrite: (path) => path.replace(/^\/api/, '') | 7 | // rewrite: (path) => path.replace(/^\/api/, '') |
| 8 | + // rewrite: (path) => path.replace(new RegExp(`^${prefix}`), ''), | ||
| 7 | } | 9 | } |
| 8 | return ret | 10 | return ret |
| 9 | } | 11 | } | ... | ... |
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | * 生成动态路由 | 2 | * 生成动态路由 |
| 3 | */ | 3 | */ |
| 4 | import _ from 'lodash' | 4 | import _ from 'lodash' |
| 5 | -import routes from "../mock/routes" | 5 | +import asyncRoutes from "../mock/routes" |
| 6 | 6 | ||
| 7 | // 根据后台返回的路径,生成页面的组件模版 | 7 | // 根据后台返回的路径,生成页面的组件模版 |
| 8 | function loadView(component) { | 8 | function loadView(component) { |
| ... | @@ -11,7 +11,7 @@ function loadView(component) { | ... | @@ -11,7 +11,7 @@ function loadView(component) { |
| 11 | 11 | ||
| 12 | const formatRoutesArr = [] | 12 | const formatRoutesArr = [] |
| 13 | 13 | ||
| 14 | -routes.forEach(route => { | 14 | +asyncRoutes.forEach(route => { |
| 15 | const router = {} | 15 | const router = {} |
| 16 | const { | 16 | const { |
| 17 | path, | 17 | path, | ... | ... |
-
Please register or login to post a comment