Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 884 Bytes

6.1-iuap应用平台前端培训_架构与扩展(数据Mock和代理).md

File metadata and controls

53 lines (39 loc) · 884 Bytes

代理数据

1、采用本地 Mock JSON 的方式

-(1)定义 Mock JSON:

// root/mock/order/delivery/removeList.json
{
    "success": true,
    "message": "删除成功"
}

-(2)配置 uba.mock.js:


module.exports = {
  "GET": [{
    "/local/user/get": "./mock/user/get.json"
  }],
  "POST": [{
    "/order/delivery/removelist": "./mock/order/delivery/removeList.json",
  }]
}

2.采用proxy 代理的方式

代理也可以是两种:

(1)接口数据都在 http://mock.yonyoucloud.com 接口管理平台上进行维护,本地配置 proxy

const proxyConfig = [{
  enable: true,
  router: "/orgcenter/*",
  url: "https://mock.yonyoucloud.com/mock/332"
}];

(2)Proxy 到测试环境的接口数据。

const proxyConfig = [{
  enable: true,
  router: "/orgcenter/*",
  url: "http://workbench.yyuap.com"
}];