@tarojs/taro 3.6.9-alpha.8 → 3.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.10",
|
|
4
4
|
"description": "Taro framework",
|
|
5
5
|
"homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
|
|
6
6
|
"main": "index.js",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"author": "O2Team",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tarojs/api": "3.6.
|
|
25
|
-
"@tarojs/runtime": "3.6.
|
|
24
|
+
"@tarojs/api": "3.6.10",
|
|
25
|
+
"@tarojs/runtime": "3.6.10"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@tarojs/helper": "3.6.
|
|
28
|
+
"@tarojs/helper": "3.6.10"
|
|
29
29
|
},
|
|
30
30
|
"peerDependenciesMeta": {
|
|
31
31
|
"@types/react": {
|
|
@@ -42,7 +42,7 @@ declare module '../../index' {
|
|
|
42
42
|
namespace getLatestUserKey {
|
|
43
43
|
interface Option {
|
|
44
44
|
/** 接口调用成功的回调函数 */
|
|
45
|
-
success?: (res:
|
|
45
|
+
success?: (res: SuccessCallbackResult) => void
|
|
46
46
|
/** 接口调用失败的回调函数 */
|
|
47
47
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
48
48
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
@@ -2,7 +2,7 @@ import Taro from '../../index'
|
|
|
2
2
|
|
|
3
3
|
declare module '../../index' {
|
|
4
4
|
namespace request {
|
|
5
|
-
interface Option
|
|
5
|
+
interface Option<T = any, U extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any> {
|
|
6
6
|
/** 开发者服务器接口地址 */
|
|
7
7
|
url: string
|
|
8
8
|
/** 请求的参数 */
|
|
@@ -14,11 +14,11 @@ declare module '../../index' {
|
|
|
14
14
|
header?: TaroGeneral.IAnyObject
|
|
15
15
|
/** 超时时间,单位为毫秒
|
|
16
16
|
* @default 2000
|
|
17
|
-
* @supported weapp, h5, tt
|
|
17
|
+
* @supported weapp, h5, tt, alipay
|
|
18
18
|
*/
|
|
19
19
|
timeout?: number
|
|
20
20
|
/** HTTP 请求方法
|
|
21
|
-
* @default GET
|
|
21
|
+
* @default "GET"
|
|
22
22
|
*/
|
|
23
23
|
method?: keyof Method
|
|
24
24
|
/** 返回的数据格式 */
|
|
@@ -54,6 +54,25 @@ declare module '../../index' {
|
|
|
54
54
|
* @supported weapp
|
|
55
55
|
*/
|
|
56
56
|
enableChunked?: boolean
|
|
57
|
+
/**
|
|
58
|
+
* wifi下使用移动网络发送请求
|
|
59
|
+
* @default false
|
|
60
|
+
* @supported weapp
|
|
61
|
+
*/
|
|
62
|
+
forceCellularNetwork?: boolean
|
|
63
|
+
/**
|
|
64
|
+
* headers 中设置 cookie 字段是否生效。如果为 false,则 headers 中的 cookie 字段将被忽略,请求头中将包含服务端上一次返回的 cookie(如果有)。
|
|
65
|
+
* @default false
|
|
66
|
+
* @supported alipay 支付宝: 10.2.33+
|
|
67
|
+
*/
|
|
68
|
+
enableCookie?: boolean
|
|
69
|
+
/**
|
|
70
|
+
* referer 策略,用于控制当前请求 header 对象中 referer 字段格式。该参数默认值可通过 app.json 中的配置进行修改。
|
|
71
|
+
* @default "querystring"
|
|
72
|
+
* @supported alipay 支付宝: 10.3.50+ APPX: 2.8.7 开发者工具: 3.5.1
|
|
73
|
+
* @see https://opendocs.alipay.com/mini/api/owycmh#referrerStrategy%20%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E
|
|
74
|
+
*/
|
|
75
|
+
referrerStrategy?: keyof ReferrerStrategy
|
|
57
76
|
/** 接口调用成功的回调函数 */
|
|
58
77
|
success?: (result: SuccessCallbackResult<T>) => void
|
|
59
78
|
/** 接口调用失败的回调函数 */
|
|
@@ -120,7 +139,8 @@ declare module '../../index' {
|
|
|
120
139
|
storeCheck?(): boolean
|
|
121
140
|
}
|
|
122
141
|
|
|
123
|
-
interface SuccessCallbackResult
|
|
142
|
+
interface SuccessCallbackResult<T extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any>
|
|
143
|
+
extends TaroGeneral.CallbackResult {
|
|
124
144
|
/** 开发者服务器返回的数据 */
|
|
125
145
|
data: T
|
|
126
146
|
/** 开发者服务器返回的 HTTP Response Header */
|
|
@@ -135,10 +155,26 @@ declare module '../../index' {
|
|
|
135
155
|
|
|
136
156
|
/** 返回的数据格式 */
|
|
137
157
|
interface DataType {
|
|
138
|
-
/**
|
|
158
|
+
/**
|
|
159
|
+
* 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse
|
|
139
160
|
* 其他: 不对返回的内容进行 JSON.parse
|
|
140
161
|
*/
|
|
141
162
|
json
|
|
163
|
+
/**
|
|
164
|
+
* 返回的数据为文本字符串
|
|
165
|
+
* @supported alipay
|
|
166
|
+
*/
|
|
167
|
+
text
|
|
168
|
+
/**
|
|
169
|
+
* 返回的数据将转换为 base64 格式字符串
|
|
170
|
+
* @supported alipay
|
|
171
|
+
*/
|
|
172
|
+
base64
|
|
173
|
+
/**
|
|
174
|
+
* 返回的数据将保持 ArrayBuffer 数据
|
|
175
|
+
* @supported alipay 支付宝: 10.1.70+
|
|
176
|
+
*/
|
|
177
|
+
arraybuffer
|
|
142
178
|
}
|
|
143
179
|
|
|
144
180
|
/** HTTP 请求方法 */
|
|
@@ -202,6 +238,21 @@ declare module '../../index' {
|
|
|
202
238
|
/** 浏览器在其HTTP缓存中寻找匹配的请求 */
|
|
203
239
|
'only-if-cached'
|
|
204
240
|
}
|
|
241
|
+
/** referer 策略 */
|
|
242
|
+
interface ReferrerStrategy {
|
|
243
|
+
/**
|
|
244
|
+
* referer 值为 https://{appid}.hybrid.alipay-eco.com/{appid}/{version}/index.html
|
|
245
|
+
*/
|
|
246
|
+
index
|
|
247
|
+
/**
|
|
248
|
+
* 保留 page(pages/xxx/yyy),referer 值为 https://{appid}.hybrid.alipay-eco.com/{appid}/{version}/index.html#{page}
|
|
249
|
+
*/
|
|
250
|
+
page
|
|
251
|
+
/**
|
|
252
|
+
* 默认值。会将发起请求时所在页面的 URL 作为 referer 值,会保留 page(pages/xxx/yyy)和 querystring(x=1&y=2)并可能有框架添加的其他参数,referer 值为 https://{appid}.hybrid.alipay-eco.com/{appid}/{version}/index.html#{page}?{querysrtring}{框架其他参数}
|
|
253
|
+
*/
|
|
254
|
+
querystring
|
|
255
|
+
}
|
|
205
256
|
}
|
|
206
257
|
|
|
207
258
|
/** 网络请求任务对象
|
|
@@ -269,7 +320,7 @@ declare module '../../index' {
|
|
|
269
320
|
*/
|
|
270
321
|
onHeadersReceived(
|
|
271
322
|
/** HTTP Response Header 事件的回调函数 */
|
|
272
|
-
callback: RequestTask.onHeadersReceived.Callback
|
|
323
|
+
callback: RequestTask.onHeadersReceived.Callback
|
|
273
324
|
): void
|
|
274
325
|
/** 取消监听 HTTP Response Header 事件
|
|
275
326
|
* @supported weapp
|
|
@@ -277,7 +328,7 @@ declare module '../../index' {
|
|
|
277
328
|
*/
|
|
278
329
|
offHeadersReceived(
|
|
279
330
|
/** HTTP Response Header 事件的回调函数 */
|
|
280
|
-
callback: RequestTask.onHeadersReceived.Callback
|
|
331
|
+
callback: RequestTask.onHeadersReceived.Callback
|
|
281
332
|
): void
|
|
282
333
|
/** 监听 Transfer-Encoding Chunk Received 事件。当接收到新的chunk时触发。
|
|
283
334
|
* @supported weapp
|
|
@@ -285,7 +336,7 @@ declare module '../../index' {
|
|
|
285
336
|
*/
|
|
286
337
|
onChunkReceived(
|
|
287
338
|
/** Transfer-Encoding Chunk Received 事件的回调函数 */
|
|
288
|
-
callback: RequestTask.onChunkReceived.Callback
|
|
339
|
+
callback: RequestTask.onChunkReceived.Callback
|
|
289
340
|
): void
|
|
290
341
|
/** 移除 Transfer-Encoding Chunk Received 事件的监听函数
|
|
291
342
|
* @supported weapp
|
|
@@ -293,7 +344,7 @@ declare module '../../index' {
|
|
|
293
344
|
*/
|
|
294
345
|
offChunkReceived(
|
|
295
346
|
/** Transfer-Encoding Chunk Received 事件的回调函数 */
|
|
296
|
-
callback: RequestTask.onChunkReceived.Callback
|
|
347
|
+
callback: RequestTask.onChunkReceived.Callback
|
|
297
348
|
): void
|
|
298
349
|
}
|
|
299
350
|
|
|
@@ -4,32 +4,34 @@ declare module '../../index' {
|
|
|
4
4
|
namespace chooseAddress {
|
|
5
5
|
interface Option {
|
|
6
6
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
-
complete?: (res:
|
|
7
|
+
complete?: (res: SuccessCallbackResult) => void
|
|
8
8
|
/** 接口调用失败的回调函数 */
|
|
9
9
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
10
|
/** 接口调用成功的回调函数 */
|
|
11
11
|
success?: (result: SuccessCallbackResult) => void
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
interface SuccessCallbackResult {
|
|
14
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
15
|
+
/** 收货人姓名 */
|
|
16
|
+
userName: string
|
|
17
|
+
/** 邮编 */
|
|
18
|
+
postalCode: string
|
|
19
|
+
/** 国标收货地址第一级地址 */
|
|
20
|
+
provinceName: string
|
|
15
21
|
/** 国标收货地址第二级地址 */
|
|
16
22
|
cityName: string
|
|
17
23
|
/** 国标收货地址第三级地址 */
|
|
18
24
|
countyName: string
|
|
25
|
+
/** 国标收货地址第四级地址 */
|
|
26
|
+
streetName: string
|
|
19
27
|
/** 详细收货地址信息 */
|
|
20
28
|
detailInfo: string
|
|
21
|
-
/**
|
|
22
|
-
|
|
29
|
+
/** 新选择器详细收货地址信息 */
|
|
30
|
+
detailInfoNew: string
|
|
23
31
|
/** 收货地址国家码 */
|
|
24
32
|
nationalCode: string
|
|
25
|
-
/** 邮编 */
|
|
26
|
-
postalCode: string
|
|
27
|
-
/** 国标收货地址第一级地址 */
|
|
28
|
-
provinceName: string
|
|
29
33
|
/** 收货人手机号码 */
|
|
30
34
|
telNumber: string
|
|
31
|
-
/** 收货人姓名 */
|
|
32
|
-
userName: string
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -31,11 +31,11 @@ declare module '../index' {
|
|
|
31
31
|
namespace setGlobalDataPlugin {
|
|
32
32
|
/** Vue3 插件,用于设置 `getApp()` 中的全局变量 */
|
|
33
33
|
interface Plugin {
|
|
34
|
-
install
|
|
34
|
+
install(app: any, data: any): void
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
/** @ignore */
|
|
39
39
|
interface TARO_ENV_TYPE {
|
|
40
40
|
[TaroGeneral.ENV_TYPE.WEAPP]: TaroGeneral.ENV_TYPE.WEAPP
|
|
41
41
|
[TaroGeneral.ENV_TYPE.WEB]: TaroGeneral.ENV_TYPE.WEB
|
|
@@ -56,7 +56,7 @@ declare module '../index' {
|
|
|
56
56
|
type InterceptorifyInterceptor<T, R> = (chain: InterceptorifyChain<T, R>) => Promise<R>
|
|
57
57
|
interface Interceptorify<T, R> {
|
|
58
58
|
request(requestParams: T): Promise<R>
|
|
59
|
-
addInterceptor(
|
|
59
|
+
addInterceptor(interceptor: InterceptorifyInterceptor<T, R>): void
|
|
60
60
|
cleanInterceptors(): void
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -101,6 +101,29 @@ declare module '../index' {
|
|
|
101
101
|
*/
|
|
102
102
|
getAppInfo(): getAppInfo.AppInfo
|
|
103
103
|
|
|
104
|
+
getEnvInfoSync(): {
|
|
105
|
+
/** 小程序信息 */
|
|
106
|
+
microapp: {
|
|
107
|
+
/** 小程序版本号 */
|
|
108
|
+
mpVersion: string
|
|
109
|
+
/** 小程序环境 */
|
|
110
|
+
envType: string
|
|
111
|
+
/** 小程序appId */
|
|
112
|
+
appId: string
|
|
113
|
+
}
|
|
114
|
+
/** 插件信息 */
|
|
115
|
+
plugin: Record<string, unknown>
|
|
116
|
+
/** 通用参数 */
|
|
117
|
+
common: {
|
|
118
|
+
/** 用户数据存储的路径 */
|
|
119
|
+
USER_DATA_PATH: string
|
|
120
|
+
/** 校验白名单属性中的appInfoLaunchFrom后返回额外信息 */
|
|
121
|
+
location: string | undefined
|
|
122
|
+
launchFrom: string | undefined
|
|
123
|
+
schema: string | undefined
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
104
127
|
/** 小程序引用插件 JS 接口
|
|
105
128
|
* @supported weapp, alipay, h5, rn, jd, qq, swan, tt, quickapp
|
|
106
129
|
*/
|
|
@@ -130,7 +153,7 @@ declare module '../index' {
|
|
|
130
153
|
setGlobalDataPlugin: setGlobalDataPlugin.Plugin
|
|
131
154
|
|
|
132
155
|
/** 获取自定义 TabBar 对应的 React 或 Vue 组件实例
|
|
133
|
-
* @supported weapp
|
|
156
|
+
* @supported weapp, jd
|
|
134
157
|
* @param page 小程序页面对象,可以通过 Taro.getCurrentInstance().page 获取
|
|
135
158
|
*/
|
|
136
159
|
getTabBar<T>(page: getCurrentInstance.Current['page']): T | undefined
|
|
@@ -8,7 +8,7 @@ import type { IH5Config } from './h5'
|
|
|
8
8
|
import type { IMiniAppConfig } from './mini'
|
|
9
9
|
import { IRNConfig } from './rn'
|
|
10
10
|
|
|
11
|
-
export type PluginItem = string | [string,
|
|
11
|
+
export type PluginItem<T = object> = string | [string, T] | [string, () => T | Promise<T>]
|
|
12
12
|
|
|
13
13
|
interface ICache {
|
|
14
14
|
/**
|