@tarojs/taro 3.6.6 → 3.6.7-alpha.1
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 +4 -4
- package/types/api/base/index.d.ts +2 -2
- package/types/api/base/weapp/app-event.d.ts +1 -1
- package/types/api/device/calendar.d.ts +2 -2
- package/types/api/media/image.d.ts +23 -12
- package/types/api/media/live.d.ts +52 -0
- package/types/api/media/video.d.ts +64 -23
- package/types/api/network/request.d.ts +18 -15
- package/types/api/taro.extend.d.ts +0 -3
- package/types/global.d.ts +8 -8
- package/types/taro.config.d.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.7-alpha.1",
|
|
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.7-alpha.1",
|
|
25
|
+
"@tarojs/runtime": "3.6.7-alpha.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@tarojs/helper": "3.6.
|
|
28
|
+
"@tarojs/helper": "3.6.7-alpha.1"
|
|
29
29
|
},
|
|
30
30
|
"peerDependenciesMeta": {
|
|
31
31
|
"@types/react": {
|
|
@@ -3,7 +3,7 @@ import Taro from '../../index'
|
|
|
3
3
|
declare module '../../index' {
|
|
4
4
|
interface TaroStatic {
|
|
5
5
|
/** 判断小程序的 API,回调,参数,组件等是否在当前版本可用。
|
|
6
|
-
* @supported weapp, tt
|
|
6
|
+
* @supported weapp, tt, h5
|
|
7
7
|
* @example
|
|
8
8
|
* ```tsx
|
|
9
9
|
* Taro.canIUse('openBluetoothAdapter')
|
|
@@ -36,7 +36,7 @@ declare module '../../index' {
|
|
|
36
36
|
): boolean
|
|
37
37
|
|
|
38
38
|
/** 判断能否使用 WebP 格式
|
|
39
|
-
*
|
|
39
|
+
*
|
|
40
40
|
* > 在小程序平台中仅在 android 和 devtools 设备时可用
|
|
41
41
|
* @supported global
|
|
42
42
|
*/
|
|
@@ -75,12 +75,12 @@ declare module '../../index' {
|
|
|
75
75
|
|
|
76
76
|
interface TaroStatic {
|
|
77
77
|
/** 向系统日历添加重复事件
|
|
78
|
-
* @supported weapp
|
|
78
|
+
* @supported weapp, h5
|
|
79
79
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneRepeatCalendar.html
|
|
80
80
|
*/
|
|
81
81
|
addPhoneRepeatCalendar(option: addPhoneRepeatCalendar.Option): Promise<TaroGeneral.CallbackResult>
|
|
82
82
|
/** 向系统日历添加事件
|
|
83
|
-
* @supported weapp, tt
|
|
83
|
+
* @supported weapp, tt, h5
|
|
84
84
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneCalendar.html
|
|
85
85
|
*/
|
|
86
86
|
addPhoneCalendar(option: addPhoneCalendar.Option): Promise<TaroGeneral.CallbackResult>
|
|
@@ -127,19 +127,30 @@ declare module '../../index' {
|
|
|
127
127
|
|
|
128
128
|
namespace chooseImage {
|
|
129
129
|
interface Option {
|
|
130
|
+
/** 最多可以选择的图片张数
|
|
131
|
+
* @default 9
|
|
132
|
+
* @supported weapp, alipay, swan, tt, h5, rn
|
|
133
|
+
*/
|
|
134
|
+
count?: number
|
|
135
|
+
/** 所选的图片的尺寸
|
|
136
|
+
* @default ['original', 'compressed']
|
|
137
|
+
* @supported weapp, alipay, swan, tt, rn
|
|
138
|
+
*/
|
|
139
|
+
sizeType?: Array<keyof sizeType>
|
|
140
|
+
/** 选择图片的来源
|
|
141
|
+
* @default ['album', 'camera']
|
|
142
|
+
* @supported weapp, alipay, swan, tt, h5, rn
|
|
143
|
+
*/
|
|
144
|
+
sourceType?: Array<keyof sourceType>
|
|
130
145
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
131
146
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
132
|
-
/** 最多可以选择的图片张数 */
|
|
133
|
-
count?: number
|
|
134
147
|
/** 接口调用失败的回调函数 */
|
|
135
148
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
136
|
-
/** 所选的图片的尺寸 */
|
|
137
|
-
sizeType?: Array<keyof sizeType>
|
|
138
|
-
/** 选择图片的来源 */
|
|
139
|
-
sourceType?: Array<keyof sourceType>
|
|
140
149
|
/** 接口调用成功的回调函数 */
|
|
141
150
|
success?: (result: SuccessCallbackResult) => void
|
|
142
|
-
/** 用来上传的input元素ID(仅h5
|
|
151
|
+
/** 用来上传的input元素ID(仅h5端
|
|
152
|
+
* @supported h5
|
|
153
|
+
*/
|
|
143
154
|
imageId?: string
|
|
144
155
|
}
|
|
145
156
|
/** 图片的尺寸 */
|
|
@@ -301,7 +312,7 @@ declare module '../../index' {
|
|
|
301
312
|
|
|
302
313
|
interface TaroStatic {
|
|
303
314
|
/** 保存图片到系统相册。需要[用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.writePhotosAlbum
|
|
304
|
-
* @supported weapp,
|
|
315
|
+
* @supported weapp, alipay, swan, tt, h5, rn
|
|
305
316
|
* @example
|
|
306
317
|
* ```tsx
|
|
307
318
|
* Taro.saveImageToPhotosAlbum({
|
|
@@ -325,7 +336,7 @@ declare module '../../index' {
|
|
|
325
336
|
previewMedia(option: previewMedia.Option): Promise<TaroGeneral.CallbackResult>
|
|
326
337
|
|
|
327
338
|
/** 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
|
|
328
|
-
* @supported weapp,
|
|
339
|
+
* @supported weapp, alipay, swan, tt, h5, rn
|
|
329
340
|
* @example
|
|
330
341
|
* ```tsx
|
|
331
342
|
* Taro.previewImage({
|
|
@@ -338,7 +349,7 @@ declare module '../../index' {
|
|
|
338
349
|
previewImage(option: previewImage.Option): Promise<TaroGeneral.CallbackResult>
|
|
339
350
|
|
|
340
351
|
/** 获取图片信息。网络图片需先配置download域名才能生效。
|
|
341
|
-
* @supported weapp,
|
|
352
|
+
* @supported weapp, alipay, swan, tt, h5, rn
|
|
342
353
|
* @example
|
|
343
354
|
* ```tsx
|
|
344
355
|
* Taro.getImageInfo({
|
|
@@ -377,7 +388,7 @@ declare module '../../index' {
|
|
|
377
388
|
editImage(option: editImage.Option): Promise<editImage.SuccessCallbackResult>
|
|
378
389
|
|
|
379
390
|
/** 压缩图片接口,可选压缩质量
|
|
380
|
-
* @supported weapp,
|
|
391
|
+
* @supported weapp, tt, rn
|
|
381
392
|
* @example
|
|
382
393
|
* ```tsx
|
|
383
394
|
* Taro.compressImage({
|
|
@@ -408,7 +419,7 @@ declare module '../../index' {
|
|
|
408
419
|
|
|
409
420
|
/**
|
|
410
421
|
* 从本地相册选择图片或使用相机拍照。
|
|
411
|
-
* @supported weapp,
|
|
422
|
+
* @supported weapp, alipay, swan, tt, h5, rn
|
|
412
423
|
* @example
|
|
413
424
|
* ```tsx
|
|
414
425
|
* Taro.chooseImage({
|
|
@@ -227,6 +227,14 @@ declare module '../../index' {
|
|
|
227
227
|
toggleTorch(option?: LivePusherContext.ToggleTorchOption): void
|
|
228
228
|
}
|
|
229
229
|
namespace LivePlayerContext {
|
|
230
|
+
interface ExitCastingOption {
|
|
231
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
232
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
233
|
+
/** 接口调用失败的回调函数 */
|
|
234
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
235
|
+
/** 接口调用成功的回调函数 */
|
|
236
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
237
|
+
}
|
|
230
238
|
interface ExitFullScreenOption {
|
|
231
239
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
232
240
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
@@ -267,6 +275,14 @@ declare module '../../index' {
|
|
|
267
275
|
/** 接口调用成功的回调函数 */
|
|
268
276
|
success?: (res: TaroGeneral.CallbackResult) => void
|
|
269
277
|
}
|
|
278
|
+
interface ReconnectCastingOption {
|
|
279
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
280
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
281
|
+
/** 接口调用失败的回调函数 */
|
|
282
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
283
|
+
/** 接口调用成功的回调函数 */
|
|
284
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
285
|
+
}
|
|
270
286
|
interface RequestFullScreenOption {
|
|
271
287
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
272
288
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
@@ -316,6 +332,14 @@ declare module '../../index' {
|
|
|
316
332
|
/** 调用结果 */
|
|
317
333
|
errMsg: string
|
|
318
334
|
}
|
|
335
|
+
interface StartCastingOption {
|
|
336
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
337
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
338
|
+
/** 接口调用失败的回调函数 */
|
|
339
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
340
|
+
/** 接口调用成功的回调函数 */
|
|
341
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
342
|
+
}
|
|
319
343
|
interface StopOption {
|
|
320
344
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
321
345
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
@@ -324,6 +348,14 @@ declare module '../../index' {
|
|
|
324
348
|
/** 接口调用成功的回调函数 */
|
|
325
349
|
success?: (res: TaroGeneral.CallbackResult) => void
|
|
326
350
|
}
|
|
351
|
+
interface SwitchCastingOption {
|
|
352
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
353
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
354
|
+
/** 接口调用失败的回调函数 */
|
|
355
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
356
|
+
/** 接口调用成功的回调函数 */
|
|
357
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
358
|
+
}
|
|
327
359
|
}
|
|
328
360
|
|
|
329
361
|
/** `LivePlayerContext` 实例,可通过 `Taro.createLivePlayerContext` 获取。
|
|
@@ -332,6 +364,11 @@ declare module '../../index' {
|
|
|
332
364
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html
|
|
333
365
|
*/
|
|
334
366
|
interface LivePlayerContext {
|
|
367
|
+
/** 退出投屏。仅支持在 tap 事件回调内调用。
|
|
368
|
+
* @supported weapp
|
|
369
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitCasting.html
|
|
370
|
+
*/
|
|
371
|
+
exitCasting(option?: LivePlayerContext.ExitCastingOption): void
|
|
335
372
|
/** 退出全屏
|
|
336
373
|
* @supported weapp
|
|
337
374
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitFullScreen.html
|
|
@@ -357,6 +394,11 @@ declare module '../../index' {
|
|
|
357
394
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.play.html
|
|
358
395
|
*/
|
|
359
396
|
play(option?: LivePlayerContext.PlayOption): void
|
|
397
|
+
/** 重连投屏设备。仅支持在 tap 事件回调内调用。
|
|
398
|
+
* @supported weapp
|
|
399
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.reconnectCasting.html
|
|
400
|
+
*/
|
|
401
|
+
reconnectCasting(option?: LivePlayerContext.ReconnectCastingOption): void
|
|
360
402
|
/** 进入全屏
|
|
361
403
|
* @supported weapp
|
|
362
404
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestFullScreen.html
|
|
@@ -381,11 +423,21 @@ declare module '../../index' {
|
|
|
381
423
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.snapshot.html
|
|
382
424
|
*/
|
|
383
425
|
snapshot(option?: LivePlayerContext.SnapshotOption): void
|
|
426
|
+
/** 开始投屏, 拉起半屏搜索设备。仅支持在 tap 事件回调内调用
|
|
427
|
+
* @supported weapp
|
|
428
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.startCasting.html
|
|
429
|
+
*/
|
|
430
|
+
startCasting(option?: LivePlayerContext.StartCastingOption): void
|
|
384
431
|
/** 停止
|
|
385
432
|
* @supported weapp
|
|
386
433
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.stop.html
|
|
387
434
|
*/
|
|
388
435
|
stop(option?: LivePlayerContext.StopOption): void
|
|
436
|
+
/** 切换投屏设备。仅支持在 tap 事件回调内调用。
|
|
437
|
+
* @supported weapp
|
|
438
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.switchCasting.html
|
|
439
|
+
*/
|
|
440
|
+
switchCasting(option?: LivePlayerContext.SwitchCastingOption): void
|
|
389
441
|
}
|
|
390
442
|
|
|
391
443
|
interface TaroStatic {
|
|
@@ -233,30 +233,42 @@ declare module '../../index' {
|
|
|
233
233
|
|
|
234
234
|
namespace chooseVideo {
|
|
235
235
|
interface Option {
|
|
236
|
-
/** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效
|
|
236
|
+
/** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效
|
|
237
|
+
* @default "back"
|
|
238
|
+
* @supported weapp, h5
|
|
239
|
+
*/
|
|
237
240
|
camera?: keyof Camera
|
|
241
|
+
/** 是否压缩所选择的视频文件
|
|
242
|
+
* @default true
|
|
243
|
+
* @supported weapp
|
|
244
|
+
*/
|
|
245
|
+
compressed?: boolean
|
|
246
|
+
/** 拍摄视频最长拍摄时间,单位秒
|
|
247
|
+
* @default 60
|
|
248
|
+
* @supported weapp
|
|
249
|
+
*/
|
|
250
|
+
maxDuration?: number
|
|
251
|
+
/** 视频选择的来源
|
|
252
|
+
* @default ['album', 'camera']
|
|
253
|
+
* @supported weapp, h5
|
|
254
|
+
*/
|
|
255
|
+
sourceType?: Array<keyof sourceType>
|
|
238
256
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
239
257
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
240
|
-
/** 是否压缩所选择的视频文件 */
|
|
241
|
-
compressed?: boolean
|
|
242
258
|
/** 接口调用失败的回调函数 */
|
|
243
259
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
244
|
-
/** 拍摄视频最长拍摄时间,单位秒 */
|
|
245
|
-
maxDuration?: number
|
|
246
|
-
/** 视频选择的来源 */
|
|
247
|
-
sourceType?: Array<keyof sourceType>
|
|
248
260
|
/** 接口调用成功的回调函数 */
|
|
249
261
|
success?: (result: SuccessCallbackResult) => void
|
|
250
262
|
}
|
|
251
263
|
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
264
|
+
/** 选定视频的临时文件路径 */
|
|
265
|
+
tempFilePath: string
|
|
252
266
|
/** 选定视频的时间长度 */
|
|
253
267
|
duration: number
|
|
254
|
-
/** 返回选定视频的高度 */
|
|
255
|
-
height: number
|
|
256
268
|
/** 选定视频的数据量大小 */
|
|
257
269
|
size: number
|
|
258
|
-
/**
|
|
259
|
-
|
|
270
|
+
/** 返回选定视频的高度 */
|
|
271
|
+
height: number
|
|
260
272
|
/** 返回选定视频的宽度 */
|
|
261
273
|
width: number
|
|
262
274
|
/** 调用结果 */
|
|
@@ -276,30 +288,53 @@ declare module '../../index' {
|
|
|
276
288
|
}
|
|
277
289
|
}
|
|
278
290
|
|
|
279
|
-
|
|
280
291
|
namespace chooseMedia {
|
|
281
292
|
interface Option {
|
|
282
|
-
/** 最多可以选择的文件个数
|
|
293
|
+
/** 最多可以选择的文件个数
|
|
294
|
+
* @default 9
|
|
295
|
+
* @supported weapp, h5
|
|
296
|
+
*/
|
|
283
297
|
count?: number
|
|
284
|
-
/** 文件类型
|
|
298
|
+
/** 文件类型
|
|
299
|
+
* @default ['image', 'video']
|
|
300
|
+
* @supported weapp, h5
|
|
301
|
+
*/
|
|
285
302
|
mediaType?: Array<keyof mediaType>
|
|
286
|
-
/** 图片和视频选择的来源
|
|
303
|
+
/** 图片和视频选择的来源
|
|
304
|
+
* @default ['album', 'camera']
|
|
305
|
+
* @supported weapp, h5
|
|
306
|
+
*/
|
|
287
307
|
sourceType?: Array<keyof sourceType>
|
|
288
|
-
/** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至
|
|
308
|
+
/** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 60s 之间
|
|
309
|
+
* @default 10
|
|
310
|
+
* @supported weapp
|
|
311
|
+
*/
|
|
289
312
|
maxDuration?: number
|
|
290
|
-
/**
|
|
313
|
+
/** 是否压缩所选文件
|
|
314
|
+
* @default ['original', 'compressed']
|
|
315
|
+
* @supported weapp
|
|
316
|
+
*/
|
|
291
317
|
sizeType?: Array<'original' | 'compressed'>
|
|
292
|
-
/** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头
|
|
318
|
+
/** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头
|
|
319
|
+
* @default "back"
|
|
320
|
+
* @supported weapp, h5
|
|
321
|
+
*/
|
|
293
322
|
camera?: string
|
|
323
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
324
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
294
325
|
/** 接口调用失败的回调函数 */
|
|
295
326
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
296
327
|
/** 接口调用成功的回调函数 */
|
|
297
328
|
success?: (result: SuccessCallbackResult) => void
|
|
329
|
+
/** 用来上传的input元素ID
|
|
330
|
+
* @supported h5
|
|
331
|
+
*/
|
|
332
|
+
mediaId?: string
|
|
298
333
|
}
|
|
299
334
|
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
300
335
|
/** 本地临时文件列表 */
|
|
301
336
|
tempFiles: ChooseMedia[]
|
|
302
|
-
/** 文件类型,有效值有 image 、video */
|
|
337
|
+
/** 文件类型,有效值有 image 、video、mix */
|
|
303
338
|
type: string
|
|
304
339
|
}
|
|
305
340
|
/** 本地临时文件列表 */
|
|
@@ -316,6 +351,12 @@ declare module '../../index' {
|
|
|
316
351
|
width: number
|
|
317
352
|
/** 视频缩略图临时文件路径 */
|
|
318
353
|
thumbTempFilePath: string
|
|
354
|
+
/** 选择的文件的类型 */
|
|
355
|
+
fileType: string
|
|
356
|
+
/** 原始的浏览器 File 对象
|
|
357
|
+
* @supported h5
|
|
358
|
+
*/
|
|
359
|
+
originalFileObj?: File
|
|
319
360
|
}
|
|
320
361
|
interface mediaType {
|
|
321
362
|
/** 只能拍摄视频或从相册选择视频 */
|
|
@@ -346,11 +387,11 @@ declare module '../../index' {
|
|
|
346
387
|
* **Bug & Tip:**
|
|
347
388
|
*
|
|
348
389
|
* 1. `tip`: camera 参数在部分 Android 手机下由于系统 ROM 不支持无法生效
|
|
349
|
-
* @supported weapp, rn
|
|
390
|
+
* @supported weapp, h5, rn
|
|
350
391
|
* @example
|
|
351
392
|
```tsx
|
|
352
393
|
* Taro.saveVideoToPhotosAlbum({
|
|
353
|
-
* filePath: '
|
|
394
|
+
* filePath: 'file://xxx',
|
|
354
395
|
* success: function (res) {
|
|
355
396
|
* console.log(res.errMsg)
|
|
356
397
|
* }
|
|
@@ -447,7 +488,7 @@ declare module '../../index' {
|
|
|
447
488
|
compressVideo(option: compressVideo.Option): Promise<compressVideo.SuccessCallbackResult>
|
|
448
489
|
|
|
449
490
|
/** 拍摄视频或从手机相册中选视频。
|
|
450
|
-
* @supported weapp, rn
|
|
491
|
+
* @supported weapp, h5, rn
|
|
451
492
|
* @example
|
|
452
493
|
* ```tsx
|
|
453
494
|
* Taro.chooseVideo({
|
|
@@ -464,7 +505,7 @@ declare module '../../index' {
|
|
|
464
505
|
chooseVideo(option: chooseVideo.Option): Promise<chooseVideo.SuccessCallbackResult>
|
|
465
506
|
|
|
466
507
|
/** 拍摄或从手机相册中选择图片或视频。
|
|
467
|
-
* @supported weapp
|
|
508
|
+
* @supported weapp, h5
|
|
468
509
|
* @example
|
|
469
510
|
* ```tsx
|
|
470
511
|
* Taro.chooseMedia({
|
|
@@ -60,58 +60,61 @@ declare module '../../index' {
|
|
|
60
60
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
61
61
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
62
62
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
63
|
-
/**
|
|
63
|
+
/** 设置是否使用 jsonp 方式获取数据
|
|
64
64
|
* @default false
|
|
65
65
|
* @supported h5
|
|
66
66
|
*/
|
|
67
|
-
jsonp?: boolean
|
|
68
|
-
/** 设置
|
|
69
|
-
* @default false
|
|
67
|
+
jsonp?: boolean | string
|
|
68
|
+
/** 设置 jsonp 请求 url 是否需要被缓存
|
|
70
69
|
* @supported h5
|
|
71
70
|
*/
|
|
72
|
-
jsonpCache?:
|
|
73
|
-
/**
|
|
71
|
+
jsonpCache?: RequestCache
|
|
72
|
+
/** 设置是否允许跨域请求
|
|
74
73
|
* @default "same-origin"
|
|
75
74
|
* @supported h5
|
|
76
75
|
*/
|
|
77
76
|
mode?: keyof CorsMode
|
|
78
|
-
/**
|
|
77
|
+
/** 设置是否携带 Cookie
|
|
79
78
|
* @default "omit"
|
|
80
79
|
* @supported h5
|
|
81
80
|
*/
|
|
82
81
|
credentials?: keyof Credentials
|
|
83
|
-
/**
|
|
82
|
+
/** 设置缓存模式
|
|
84
83
|
* @default "default"
|
|
85
84
|
* @supported h5
|
|
86
85
|
*/
|
|
87
86
|
cache?: keyof Cache
|
|
88
|
-
/**
|
|
87
|
+
/** 设置请求重试次数
|
|
89
88
|
* @default 2
|
|
90
89
|
* @supported h5
|
|
91
90
|
*/
|
|
92
91
|
retryTimes?: number
|
|
93
|
-
/**
|
|
92
|
+
/** 设置请求的兜底接口
|
|
94
93
|
* @supported h5
|
|
95
94
|
*/
|
|
96
95
|
backup?: string | string[]
|
|
97
|
-
/**
|
|
96
|
+
/** 设置请求中止信号
|
|
97
|
+
* @supported h5
|
|
98
|
+
*/
|
|
99
|
+
signal?: AbortSignal
|
|
100
|
+
/** 设置请求响应的数据校验函数,若返回 false,则请求兜底接口,若无兜底接口,则报请求失败
|
|
98
101
|
* @supported h5
|
|
99
102
|
*/
|
|
100
103
|
dataCheck?(): boolean
|
|
101
|
-
/**
|
|
104
|
+
/** 设置请求是否使用缓存
|
|
102
105
|
* @default false
|
|
103
106
|
* @supported h5
|
|
104
107
|
*/
|
|
105
108
|
useStore?: boolean
|
|
106
|
-
/**
|
|
109
|
+
/** 设置请求缓存校验的 key
|
|
107
110
|
* @supported h5
|
|
108
111
|
*/
|
|
109
112
|
storeCheckKey?: string
|
|
110
|
-
/**
|
|
113
|
+
/** 设置请求缓存签名
|
|
111
114
|
* @supported h5
|
|
112
115
|
*/
|
|
113
116
|
storeSign?: string
|
|
114
|
-
/**
|
|
117
|
+
/** 设置请求校验函数,一般不需要设置
|
|
115
118
|
* @supported h5
|
|
116
119
|
*/
|
|
117
120
|
storeCheck?(): boolean
|
package/types/global.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare namespace TaroGeneral {
|
|
|
6
6
|
type EventCallback = (
|
|
7
7
|
/** 触发事件参数 */
|
|
8
8
|
...args: any
|
|
9
|
-
|
|
9
|
+
) => void
|
|
10
10
|
/** 通用错误 */
|
|
11
11
|
interface CallbackResult {
|
|
12
12
|
/** 错误信息 */
|
|
@@ -35,7 +35,7 @@ declare namespace TaroGeneral {
|
|
|
35
35
|
/** 阻止事件冒泡到父元素,阻止任何父事件处理程序被执行 */
|
|
36
36
|
stopPropagation: () => void
|
|
37
37
|
}
|
|
38
|
-
interface currentTarget extends Target {}
|
|
38
|
+
interface currentTarget extends Target { }
|
|
39
39
|
interface Target {
|
|
40
40
|
/** 事件源组件的id */
|
|
41
41
|
id: string
|
|
@@ -378,33 +378,33 @@ declare namespace TaroGeneral {
|
|
|
378
378
|
*/
|
|
379
379
|
13024
|
|
380
380
|
}
|
|
381
|
-
|
|
381
|
+
type EventName = string | symbol
|
|
382
382
|
// Events
|
|
383
383
|
class Events {
|
|
384
384
|
/**
|
|
385
385
|
* 监听一个事件,接受参数
|
|
386
386
|
*/
|
|
387
|
-
on(eventName:
|
|
387
|
+
on (eventName: EventName, listener: (...args: any[]) => void): this
|
|
388
388
|
|
|
389
389
|
/**
|
|
390
390
|
* 添加一个事件监听,并在事件触发完成之后移除Callbacks链
|
|
391
391
|
*/
|
|
392
|
-
once(eventName:
|
|
392
|
+
once (eventName: EventName, listener: (...args: any[]) => void): this
|
|
393
393
|
|
|
394
394
|
/**
|
|
395
395
|
* 取消监听一个事件
|
|
396
396
|
*/
|
|
397
|
-
off(eventName:
|
|
397
|
+
off (eventName: EventName, listener?: (...args: any[]) => void): this
|
|
398
398
|
|
|
399
399
|
/**
|
|
400
400
|
* 取消监听的所有事件
|
|
401
401
|
*/
|
|
402
|
-
off(): this
|
|
402
|
+
off (): this
|
|
403
403
|
|
|
404
404
|
/**
|
|
405
405
|
* 触发一个事件,传参
|
|
406
406
|
*/
|
|
407
|
-
trigger(eventName:
|
|
407
|
+
trigger (eventName: EventName, ...args: any[]): this
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
// ENV_TYPE
|
package/types/taro.config.d.ts
CHANGED