Skip to content

Commit edb15e5

Browse files
author
A pessimistic guide to living
committed
refine: 请求添加微信小程序条件编译 只有不是微信才会添加responseType为json 顺便给options放在最下面 方便替换
1 parent 6f08b78 commit edb15e5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/utils/http.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ export const http = <T>(options: CustomRequestOptions) => {
55
// 1. 返回 Promise 对象
66
return new Promise<IResData<T>>((resolve, reject) => {
77
uni.request({
8-
...options,
98
dataType: 'json',
10-
responseType: 'text',
9+
// #ifndef WP-WEIXIN
10+
responseType: 'json',
11+
// #endif
12+
...options,
1113
// 响应成功
1214
success(res) {
1315
// 状态码 2xx,参考 axios 的设计

0 commit comments

Comments
 (0)