公共接口

公共接口的相关操作方法

vue 配置

存储

1
2
3
4
5
6
// store.js
apiOrigin: "http://ceoapi.hotkidclub.com:8280",
apiPort: [
"getList:/getList",
"subData:/submit",
],

拼接取用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
computed: {
API: {
get: () => {
let serve = {};
let portAddress = store.state.apiPort.map(
e => store.state.apiOrigin + e.split(":")[1]
);
let portName = store.state.apiPort.map(e => e.split(":")[0]);
for (let i = 0; i < portName.length; i++) {
serve[portName[i]] = portAddress[i];
}
return serve;
}
}
},