add 开发文档

This commit is contained in:
2021-07-09 17:41:27 +08:00
parent 6c01b43550
commit b40f86b310
19 changed files with 1038 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
export default {
/* 自定义的接口名称 */
apiName: [
/* 接口地址 */
url,
/* 请求类型 [get | post] */
'get',
/* axios所需的设置参数 */
options,
],
/* 默认为get接口 */
apiPostName: getUrl
}

View File

@@ -0,0 +1,25 @@
import { api } from 'common/api'
api.apiName(params)
.then(res => {
/* ... */
})
.catch(error => {
/* catch */
})
.finally(() => {
/* finally */
})
// 或者采用异步
async function foo() {
try {
const res = await api.apiName(params)
/* ... */
} catch (error) {
/* catch */
} finally {
/* finally */
}
}