UNPKG

cnetong-core-frontend

Version:

- CURD组件的编辑对话框增加按钮slot

25 lines (23 loc) 571 B
/** * 创建一个服务代理 * @param {String} apiPath 本地API地址 * @param {String} target 目标代理服务器 */ function newProxy(apiPath, target) { let _sp = target.split("/"); let ctx = _sp[_sp.length - 1]; let pathRewrite = { [`^${apiPath}/`]: "/" }; let cookiePathRewrite = { ["/" + ctx]: apiPath }; let proxy = { [apiPath + "/"]: { target, changeOrigin: true, ws: true, secure: false, pathRewrite, cookiePathRewrite } }; return proxy; } module.exports = { newProxy };