diff --git a/docs/base/8-request.md b/docs/base/8-request.md index 6048a35..a5b5a95 100644 --- a/docs/base/8-request.md +++ b/docs/base/8-request.md @@ -75,6 +75,32 @@ export const getFooAPI2 = (name: string) => { 依然非常简洁,深受妹子喜爱。 +> 完成范例如下 + +```ts +/** GET 请求 */ +export const getFooAPI = (name: string) => { + return http.get('/foo', { name }) +} +/** GET 请求;支持 传递 header 的范例 */ +export const getFooAPI2 = (name: string) => { + return http.get('/foo', { name }, { 'Content-Type-100': '100' }) +} + +/** POST 请求 */ +export const postFooAPI = (name: string) => { + return http.post('/foo', { name }) +} +/** POST 请求;需要传递 query 参数的范例;微信小程序经常有同时需要query参数和body参数的场景 */ +export const postFooAPI2 = (name: string) => { + return http.post('/foo', { name }) +} +/** POST 请求;支持 传递 header 的范例 */ +export const postFooAPI3 = (name: string) => { + return http.post('/foo', { name }, { name }, { 'Content-Type-100': '100' }) +} +``` + ## 图片上传 `template` 部分编码如下: