@tarojs/taro 4.0.0-beta.1 → 4.0.0-beta.3
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 +10 -5
- package/types/api/base/debug.d.ts +8 -8
- package/types/api/base/env.d.ts +1 -1
- package/types/api/base/index.d.ts +3 -3
- package/types/api/base/system.d.ts +6 -6
- package/types/api/base/weapp/app-event.d.ts +10 -10
- package/types/api/base/weapp/life-cycle.d.ts +1 -1
- package/types/api/canvas/index.d.ts +367 -63
- package/types/api/device/battery.d.ts +1 -1
- package/types/api/device/clipboard.d.ts +2 -2
- package/types/api/device/keyboard.d.ts +1 -1
- package/types/api/device/network.d.ts +3 -3
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/screen.d.ts +2 -2
- package/types/api/files/index.d.ts +7 -7
- package/types/api/framework/index.d.ts +2 -2
- package/types/api/location/index.d.ts +4 -4
- package/types/api/media/audio.d.ts +11 -11
- package/types/api/media/background-audio.d.ts +1 -1
- package/types/api/media/image.d.ts +5 -5
- package/types/api/media/video.d.ts +11 -11
- package/types/api/navigate/index.d.ts +1 -1
- package/types/api/network/download.d.ts +5 -5
- package/types/api/network/request.d.ts +5 -5
- package/types/api/network/upload.d.ts +7 -7
- package/types/api/network/websocket.d.ts +8 -8
- package/types/api/open-api/account.d.ts +1 -1
- package/types/api/open-api/address.d.ts +13 -5
- package/types/api/open-api/authorize.d.ts +1 -1
- package/types/api/open-api/bookshelf.d.ts +307 -0
- package/types/api/open-api/channels.d.ts +16 -0
- package/types/api/open-api/device-voip.d.ts +40 -0
- package/types/api/open-api/invoice.d.ts +1 -1
- package/types/api/open-api/login.d.ts +15 -2
- package/types/api/open-api/privacy.d.ts +8 -0
- package/types/api/open-api/settings.d.ts +3 -2
- package/types/api/open-api/sticker.d.ts +83 -0
- package/types/api/open-api/subscribe-message.d.ts +148 -6
- package/types/api/open-api/user-info.d.ts +6 -1
- package/types/api/qq/index.d.ts +306 -1
- package/types/api/route/index.d.ts +5 -5
- package/types/api/storage/index.d.ts +10 -10
- package/types/api/swan/download-package.d.ts +80 -0
- package/types/api/swan/index.d.ts +151 -0
- package/types/api/swan/pay.d.ts +139 -0
- package/types/api/taro.extend.d.ts +6 -3
- package/types/api/taro.hooks.d.ts +9 -9
- package/types/api/ui/animation.d.ts +32 -32
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +1 -1
- package/types/api/ui/interaction.d.ts +6 -6
- package/types/api/ui/menu.d.ts +1 -1
- package/types/api/ui/navigation-bar.d.ts +2 -2
- package/types/api/ui/pull-down-refresh.d.ts +2 -2
- package/types/api/ui/scroll.d.ts +1 -1
- package/types/api/ui/tab-bar.d.ts +8 -8
- package/types/api/ui/window.d.ts +2 -2
- package/types/api/wxml/index.d.ts +17 -17
- package/types/compile/compiler.d.ts +2 -0
- package/types/compile/config/harmony.d.ts +5 -0
- package/types/compile/config/mini.d.ts +1 -1
- package/types/compile/viteCompilerContext.d.ts +6 -0
- package/types/global.d.ts +2 -1
- package/types/index.d.ts +13 -4
- package/types/taro.api.d.ts +22 -14
- package/types/taro.config.d.ts +6 -2
|
@@ -38,7 +38,7 @@ declare module '../../index' {
|
|
|
38
38
|
getBatteryInfoSync(): getBatteryInfoSync.Result
|
|
39
39
|
|
|
40
40
|
/** 获取设备电量。同步 API Taro.getBatteryInfoSync 在 iOS 上不可用。
|
|
41
|
-
* @supported weapp, alipay, swan, jd, qq, h5, harmony
|
|
41
|
+
* @supported weapp, alipay, swan, jd, qq, h5, harmony, harmony_hybrid
|
|
42
42
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html
|
|
43
43
|
*/
|
|
44
44
|
getBatteryInfo(option?: getBatteryInfo.Option): Promise<getBatteryInfo.SuccessCallbackResult>
|
|
@@ -43,7 +43,7 @@ declare module '../../index' {
|
|
|
43
43
|
|
|
44
44
|
interface TaroStatic {
|
|
45
45
|
/** 设置系统剪贴板的内容。调用成功后,会弹出 toast 提示"内容已复制",持续 1.5s
|
|
46
|
-
* @supported weapp, swan, jd, qq, tt, h5, rn, harmony
|
|
46
|
+
* @supported weapp, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid
|
|
47
47
|
* @h5 部分实现
|
|
48
48
|
* @example
|
|
49
49
|
* ```tsx
|
|
@@ -64,7 +64,7 @@ declare module '../../index' {
|
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* 获取系统剪贴板内容
|
|
67
|
-
* @supported weapp, swan, jd, qq, tt, h5, rn, harmony
|
|
67
|
+
* @supported weapp, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid
|
|
68
68
|
* @h5 部分实现
|
|
69
69
|
* @example
|
|
70
70
|
* ```tsx
|
|
@@ -43,7 +43,7 @@ declare module '../../index' {
|
|
|
43
43
|
|
|
44
44
|
interface TaroStatic {
|
|
45
45
|
/** 在input、textarea等focus拉起键盘之后,手动调用此接口收起键盘
|
|
46
|
-
* @supported weapp, alipay, swan, jd, tt, rn
|
|
46
|
+
* @supported weapp, alipay, swan, jd, tt, rn, harmony_hybrid
|
|
47
47
|
* @example
|
|
48
48
|
* ```tsx
|
|
49
49
|
* Taro.hideKeyboard({
|
|
@@ -107,7 +107,7 @@ declare module '../../index' {
|
|
|
107
107
|
): void
|
|
108
108
|
|
|
109
109
|
/** 监听网络状态变化。
|
|
110
|
-
* @supported weapp, swan, h5, rn, tt, harmony
|
|
110
|
+
* @supported weapp, swan, h5, rn, tt, harmony, harmony_hybrid
|
|
111
111
|
* @example
|
|
112
112
|
* ```tsx
|
|
113
113
|
* Taro.onNetworkStatusChange(function (res) {
|
|
@@ -132,7 +132,7 @@ declare module '../../index' {
|
|
|
132
132
|
): void
|
|
133
133
|
|
|
134
134
|
/** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听。
|
|
135
|
-
* @supported weapp, swan, h5, rn, harmony
|
|
135
|
+
* @supported weapp, swan, h5, rn, harmony, harmony_hybrid
|
|
136
136
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html
|
|
137
137
|
*/
|
|
138
138
|
offNetworkStatusChange(
|
|
@@ -141,7 +141,7 @@ declare module '../../index' {
|
|
|
141
141
|
): void
|
|
142
142
|
|
|
143
143
|
/** 获取网络类型。
|
|
144
|
-
* @supported weapp, swan, qq, h5, rn, tt, harmony
|
|
144
|
+
* @supported weapp, swan, qq, h5, rn, tt, harmony, harmony_hybrid
|
|
145
145
|
* @example
|
|
146
146
|
* ```tsx
|
|
147
147
|
* Taro.getNetworkType({
|
|
@@ -123,7 +123,7 @@ declare module '../../index' {
|
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* 设置是否保持常亮状态。仅在当前小程序生效,离开小程序后设置失效。
|
|
126
|
-
* @supported weapp, alipay, swan, jd, qq, tt, rn
|
|
126
|
+
* @supported weapp, alipay, swan, jd, qq, tt, rn, harmony_hybrid
|
|
127
127
|
* @example
|
|
128
128
|
* ```tsx
|
|
129
129
|
* // 保持屏幕常亮
|
|
@@ -137,7 +137,7 @@ declare module '../../index' {
|
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* 监听用户主动截屏事件,用户使用系统截屏按键截屏时触发此事件
|
|
140
|
-
* @supported weapp, alipay, swan, jd, tt
|
|
140
|
+
* @supported weapp, alipay, swan, jd, tt, harmony_hybrid
|
|
141
141
|
* @example
|
|
142
142
|
* ```tsx
|
|
143
143
|
* Taro.onUserCaptureScreen(function (res) {
|
|
@@ -196,12 +196,12 @@ declare module '../../index' {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
/** 文件管理器,可通过 [Taro.getFileSystemManager](./getFileSystemManager) 获取。
|
|
199
|
-
* @supported weapp, tt
|
|
199
|
+
* @supported weapp, tt, harmony_hybrid
|
|
200
200
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.html
|
|
201
201
|
*/
|
|
202
202
|
interface FileSystemManager {
|
|
203
203
|
/** 判断文件/目录是否存在
|
|
204
|
-
* @supported weapp, alipay, swan, jd, qq, tt
|
|
204
|
+
* @supported weapp, alipay, swan, jd, qq, tt, harmony_hybrid
|
|
205
205
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html
|
|
206
206
|
*/
|
|
207
207
|
access(option: FileSystemManager.AccessOption): void
|
|
@@ -276,7 +276,7 @@ declare module '../../index' {
|
|
|
276
276
|
*/
|
|
277
277
|
ftruncateSync(option: FileSystemManager.FtruncateSyncOption): void
|
|
278
278
|
/** 获取该小程序下的 `本地临时文件` 或 `本地缓存文件` 信息
|
|
279
|
-
* @supported weapp, alipay, swan, jd, qq, tt
|
|
279
|
+
* @supported weapp, alipay, swan, jd, qq, tt, harmony_hybrid
|
|
280
280
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getFileInfo.html
|
|
281
281
|
*/
|
|
282
282
|
getFileInfo(option: FileSystemManager.getFileInfoOption): void
|
|
@@ -339,12 +339,12 @@ declare module '../../index' {
|
|
|
339
339
|
dirPath: string,
|
|
340
340
|
): string[]
|
|
341
341
|
/** 读取本地文件内容
|
|
342
|
-
* @supported weapp, alipay, swan, jd, qq, tt
|
|
342
|
+
* @supported weapp, alipay, swan, jd, qq, tt, harmony_hybrid
|
|
343
343
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html
|
|
344
344
|
*/
|
|
345
345
|
readFile(option: FileSystemManager.ReadFileOption): void
|
|
346
346
|
/** [FileSystemManager.readFile](#readfile) 的同步版本
|
|
347
|
-
* @supported weapp, alipay, swan, jd, qq, tt
|
|
347
|
+
* @supported weapp, alipay, swan, jd, qq, tt, harmony_hybrid
|
|
348
348
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFileSync.html
|
|
349
349
|
*/
|
|
350
350
|
readFileSync(
|
|
@@ -1399,7 +1399,7 @@ declare module '../../index' {
|
|
|
1399
1399
|
/** 新开页面打开文档,支持格式
|
|
1400
1400
|
* @supported weapp, alipay, swan, jd, qq, tt
|
|
1401
1401
|
* @example
|
|
1402
|
-
```tsx
|
|
1402
|
+
* ```tsx
|
|
1403
1403
|
* Taro.downloadFile({
|
|
1404
1404
|
* url: 'https://example.com/somefile.pdf',
|
|
1405
1405
|
* success: function (res) {
|
|
@@ -1464,7 +1464,7 @@ declare module '../../index' {
|
|
|
1464
1464
|
getFileInfo(option: getFileInfo.Option): Promise<getFileInfo.SuccessCallbackResult | getFileInfo.FailCallbackResult>
|
|
1465
1465
|
|
|
1466
1466
|
/** 获取全局唯一的文件管理器
|
|
1467
|
-
* @supported weapp, alipay, swan, jd, qq, tt
|
|
1467
|
+
* @supported weapp, alipay, swan, jd, qq, tt, harmony_hybrid
|
|
1468
1468
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileSystemManager.html
|
|
1469
1469
|
*/
|
|
1470
1470
|
getFileSystemManager(): FileSystemManager
|
|
@@ -33,7 +33,7 @@ declare module '../../index' {
|
|
|
33
33
|
* __注意:__
|
|
34
34
|
* - __不要尝试修改页面栈,会导致路由以及页面状态错误。__
|
|
35
35
|
* - 不要在 `App.onLaunch` 的时候调用 `getCurrentPages()`,此时 `page` 还没有生成。
|
|
36
|
-
* @supported weapp, h5, rn, tt
|
|
36
|
+
* @supported weapp, h5, rn, tt, harmony_hybrid
|
|
37
37
|
* @example
|
|
38
38
|
* ```tsx
|
|
39
39
|
* Taro.getCurrentPages().length
|
|
@@ -43,7 +43,7 @@ declare module '../../index' {
|
|
|
43
43
|
getCurrentPages(): Page[]
|
|
44
44
|
|
|
45
45
|
/** 获取到小程序全局唯一的 App 实例。
|
|
46
|
-
* @supported weapp, alipay, h5, rn, jd, qq, swan, tt, quickapp
|
|
46
|
+
* @supported weapp, alipay, h5, rn, jd, qq, swan, tt, quickapp, harmony_hybrid
|
|
47
47
|
* @see https://developers.weixin.qq.com/miniprogram/dev/reference/api/getApp.html
|
|
48
48
|
*/
|
|
49
49
|
getApp<T = TaroGeneral.IAnyObject>(opts?: getApp.Option): getApp.Instance<T>
|
|
@@ -386,7 +386,7 @@ declare module '../../index' {
|
|
|
386
386
|
startLocationUpdate(option?: startLocationUpdate.Option): void
|
|
387
387
|
|
|
388
388
|
/** 使用微信内置地图查看位置
|
|
389
|
-
* @supported weapp, alipay, swan, jd, tt, h5
|
|
389
|
+
* @supported weapp, alipay, swan, jd, tt, h5, harmony_hybrid
|
|
390
390
|
* @example
|
|
391
391
|
* ```tsx
|
|
392
392
|
* Taro.getLocation({
|
|
@@ -455,7 +455,7 @@ declare module '../../index' {
|
|
|
455
455
|
* **注意**
|
|
456
456
|
* - 工具中定位模拟使用IP定位,可能会有一定误差。且工具目前仅支持 gcj02 坐标。
|
|
457
457
|
* - 使用第三方服务进行逆地址解析时,请确认第三方服务默认的坐标系,正确进行坐标转换。
|
|
458
|
-
* @supported weapp, swan, jd, qq, tt, rn
|
|
458
|
+
* @supported weapp, swan, jd, qq, tt, rn, harmony_hybrid
|
|
459
459
|
* @example
|
|
460
460
|
* ```tsx
|
|
461
461
|
* Taro.getLocation({
|
|
@@ -481,7 +481,7 @@ declare module '../../index' {
|
|
|
481
481
|
/** 打开地图选择位置。
|
|
482
482
|
*
|
|
483
483
|
* `chooseLocation` api功能是依赖于腾讯位置服务,所以需要使用 api 密钥。如果您没有,可以前往腾讯位置服务[开发者控制台](https://lbs.qq.com/console/mykey.html?console=mykey)进行申请。
|
|
484
|
-
* @supported weapp, alipay, swan, jd, tt, h5
|
|
484
|
+
* @supported weapp, alipay, swan, jd, tt, h5, harmony_hybrid
|
|
485
485
|
* @example
|
|
486
486
|
* ```tsx
|
|
487
487
|
* // config/index.js
|
|
@@ -499,7 +499,7 @@ declare module '../../index' {
|
|
|
499
499
|
chooseLocation(option: chooseLocation.Option): Promise<chooseLocation.SuccessCallbackResult>
|
|
500
500
|
|
|
501
501
|
/** 获取当前的模糊地理位置
|
|
502
|
-
* @supported weapp
|
|
502
|
+
* @supported weapp, harmony_hybrid
|
|
503
503
|
* @example
|
|
504
504
|
* ```tsx
|
|
505
505
|
* Taro.getFuzzyLocation({
|
|
@@ -160,17 +160,17 @@ declare module '../../index' {
|
|
|
160
160
|
/** `AudioContext` 实例,可通过 `Taro.createAudioContext` 获取。
|
|
161
161
|
*
|
|
162
162
|
* `AudioContext` 通过 `id` 跟一个 `audio` 组件绑定,操作对应的 audio 组件。
|
|
163
|
-
* @supported weapp
|
|
163
|
+
* @supported weapp, harmony_hybrid
|
|
164
164
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.html
|
|
165
165
|
*/
|
|
166
166
|
interface AudioContext {
|
|
167
167
|
/** 暂停音频。
|
|
168
|
-
* @supported weapp
|
|
168
|
+
* @supported weapp, harmony_hybrid
|
|
169
169
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.pause.html
|
|
170
170
|
*/
|
|
171
171
|
pause(): void
|
|
172
172
|
/** 播放音频。
|
|
173
|
-
* @supported weapp
|
|
173
|
+
* @supported weapp, harmony_hybrid
|
|
174
174
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.play.html
|
|
175
175
|
*/
|
|
176
176
|
play(): void
|
|
@@ -270,7 +270,7 @@ declare module '../../index' {
|
|
|
270
270
|
/** origin: 发送完整的 referrer; no-referrer: 不发送 */
|
|
271
271
|
referrerPolicy?: 'origin' | 'no-referrer' | string
|
|
272
272
|
/** 播放
|
|
273
|
-
* @supported weapp, h5, rn
|
|
273
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
274
274
|
*/
|
|
275
275
|
play(): void
|
|
276
276
|
/** 暂停
|
|
@@ -278,7 +278,7 @@ declare module '../../index' {
|
|
|
278
278
|
*/
|
|
279
279
|
pause(): void
|
|
280
280
|
/** 停止
|
|
281
|
-
* @supported weapp, h5, rn
|
|
281
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
282
282
|
*/
|
|
283
283
|
stop(): void
|
|
284
284
|
/** 跳转到指定位置,单位 s
|
|
@@ -294,7 +294,7 @@ declare module '../../index' {
|
|
|
294
294
|
*/
|
|
295
295
|
onCanplay(callback?: InnerAudioContext.OnCanplayCallback): void
|
|
296
296
|
/** 音频播放事件
|
|
297
|
-
* @supported weapp, h5, rn
|
|
297
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
298
298
|
*/
|
|
299
299
|
onPlay(callback?: InnerAudioContext.OnPlayCallback): void
|
|
300
300
|
/** 音频暂停事件
|
|
@@ -302,11 +302,11 @@ declare module '../../index' {
|
|
|
302
302
|
*/
|
|
303
303
|
onPause(callback?: InnerAudioContext.OnPauseCallback): void
|
|
304
304
|
/** 音频停止事件
|
|
305
|
-
* @supported weapp, h5, rn
|
|
305
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
306
306
|
*/
|
|
307
307
|
onStop(callback?: InnerAudioContext.OnStopCallback): void
|
|
308
308
|
/** 音频自然播放结束事件
|
|
309
|
-
* @supported weapp, h5, rn
|
|
309
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
310
310
|
*/
|
|
311
311
|
onEnded(callback?: InnerAudioContext.OnEndedCallback): void
|
|
312
312
|
/** 音频播放进度更新事件
|
|
@@ -314,7 +314,7 @@ declare module '../../index' {
|
|
|
314
314
|
*/
|
|
315
315
|
onTimeUpdate(callback?: InnerAudioContext.OnTimeUpdateCallback): void
|
|
316
316
|
/** 音频播放错误事件
|
|
317
|
-
* @supported weapp, h5, rn
|
|
317
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
318
318
|
*/
|
|
319
319
|
onError(callback?: InnerAudioContext.OnErrorCallback): void
|
|
320
320
|
/** 音频加载中事件,当音频因为数据不足,需要停下来加载时会触发
|
|
@@ -963,7 +963,7 @@ declare module '../../index' {
|
|
|
963
963
|
createMediaAudioPlayer(): MediaAudioPlayer
|
|
964
964
|
|
|
965
965
|
/** 创建内部 audio 上下文 InnerAudioContext 对象。
|
|
966
|
-
* @supported weapp, h5, rn, tt
|
|
966
|
+
* @supported weapp, h5, rn, tt, harmony_hybrid
|
|
967
967
|
* @example
|
|
968
968
|
* ```tsx
|
|
969
969
|
* const innerAudioContext = Taro.createInnerAudioContext()
|
|
@@ -983,7 +983,7 @@ declare module '../../index' {
|
|
|
983
983
|
|
|
984
984
|
/** 创建 audio 上下文 AudioContext 对象。
|
|
985
985
|
* **注意:1.6.0 版本开始,本接口不再维护。建议使用能力更强的 [Taro.createInnerAudioContext](./createInnerAudioContext) 接口**
|
|
986
|
-
* @supported weapp
|
|
986
|
+
* @supported weapp, harmony_hybrid
|
|
987
987
|
* @example
|
|
988
988
|
* ```tsx
|
|
989
989
|
* const audioCtx = Taro.createAudioContext('myAudio')
|
|
@@ -274,7 +274,7 @@ declare module '../../index' {
|
|
|
274
274
|
* 小程序切入后台,如果音频处于播放状态,可以继续播放。但是后台状态不能通过调用API操纵音频的播放状态。
|
|
275
275
|
*
|
|
276
276
|
* 从微信客户端6.7.2版本开始,若需要在小程序切后台后继续播放音频,需要在 [app.json](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html) 中配置 `requiredBackgroundModes` 属性。开发版和体验版上可以直接生效,正式版还需通过审核。
|
|
277
|
-
* @supported weapp, tt
|
|
277
|
+
* @supported weapp, tt, harmony_hybrid
|
|
278
278
|
* @example
|
|
279
279
|
* ```tsx
|
|
280
280
|
* const backgroundAudioManager = Taro.getBackgroundAudioManager()
|
|
@@ -324,7 +324,7 @@ declare module '../../index' {
|
|
|
324
324
|
|
|
325
325
|
interface TaroStatic {
|
|
326
326
|
/** 保存图片到系统相册。需要[用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.writePhotosAlbum
|
|
327
|
-
* @supported weapp, alipay, swan, tt, h5, rn
|
|
327
|
+
* @supported weapp, alipay, swan, tt, h5, rn, harmony_hybrid
|
|
328
328
|
* @example
|
|
329
329
|
* ```tsx
|
|
330
330
|
* Taro.saveImageToPhotosAlbum({
|
|
@@ -348,7 +348,7 @@ declare module '../../index' {
|
|
|
348
348
|
previewMedia(option: previewMedia.Option): Promise<TaroGeneral.CallbackResult>
|
|
349
349
|
|
|
350
350
|
/** 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
|
|
351
|
-
* @supported weapp, alipay, swan, tt, h5, rn
|
|
351
|
+
* @supported weapp, alipay, swan, tt, h5, rn, harmony_hybrid
|
|
352
352
|
* @example
|
|
353
353
|
* ```tsx
|
|
354
354
|
* Taro.previewImage({
|
|
@@ -361,7 +361,7 @@ declare module '../../index' {
|
|
|
361
361
|
previewImage(option: previewImage.Option): Promise<TaroGeneral.CallbackResult>
|
|
362
362
|
|
|
363
363
|
/** 获取图片信息。网络图片需先配置download域名才能生效。
|
|
364
|
-
* @supported weapp, alipay, swan, tt, h5, rn, harmony
|
|
364
|
+
* @supported weapp, alipay, swan, tt, h5, rn, harmony, harmony_hybrid
|
|
365
365
|
* @example
|
|
366
366
|
* ```tsx
|
|
367
367
|
* Taro.getImageInfo({
|
|
@@ -421,7 +421,7 @@ declare module '../../index' {
|
|
|
421
421
|
* type: 'image',
|
|
422
422
|
* success: function (res) {
|
|
423
423
|
* // tempFilePath可以作为img标签的src属性显示图片
|
|
424
|
-
* const tempFilePaths = res.
|
|
424
|
+
* const tempFilePaths = res.tempFiles
|
|
425
425
|
* }
|
|
426
426
|
* })
|
|
427
427
|
* ```
|
|
@@ -431,7 +431,7 @@ declare module '../../index' {
|
|
|
431
431
|
|
|
432
432
|
/**
|
|
433
433
|
* 从本地相册选择图片或使用相机拍照。
|
|
434
|
-
* @supported weapp, alipay, swan, tt, h5, rn
|
|
434
|
+
* @supported weapp, alipay, swan, tt, h5, rn, harmony_hybrid
|
|
435
435
|
* @example
|
|
436
436
|
* ```tsx
|
|
437
437
|
* Taro.chooseImage({
|
|
@@ -89,7 +89,7 @@ declare module '../../index' {
|
|
|
89
89
|
/** VideoContext 实例,可通过 [Taro.createVideoContext](./createVideoContext) 获取。
|
|
90
90
|
*
|
|
91
91
|
* VideoContext 通过 id 跟一个 video 组件绑定,操作对应的 video 组件。
|
|
92
|
-
* @supported weapp, h5, rn
|
|
92
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
93
93
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html
|
|
94
94
|
*/
|
|
95
95
|
interface VideoContext {
|
|
@@ -99,7 +99,7 @@ declare module '../../index' {
|
|
|
99
99
|
*/
|
|
100
100
|
exitBackgroundPlayback(): void
|
|
101
101
|
/** 退出全屏
|
|
102
|
-
* @supported weapp, h5, rn
|
|
102
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
103
103
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitFullScreen.html
|
|
104
104
|
*/
|
|
105
105
|
exitFullScreen(): void
|
|
@@ -114,17 +114,17 @@ declare module '../../index' {
|
|
|
114
114
|
*/
|
|
115
115
|
hideStatusBar(): void
|
|
116
116
|
/** 暂停视频
|
|
117
|
-
* @supported weapp, h5, rn
|
|
117
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
118
118
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.pause.html
|
|
119
119
|
*/
|
|
120
120
|
pause(): void
|
|
121
121
|
/** 播放视频
|
|
122
|
-
* @supported weapp, h5, rn
|
|
122
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
123
123
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.play.html
|
|
124
124
|
*/
|
|
125
125
|
play(): void
|
|
126
126
|
/** 设置倍速播放
|
|
127
|
-
* @supported weapp, h5, rn
|
|
127
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
128
128
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.playbackRate.html
|
|
129
129
|
*/
|
|
130
130
|
playbackRate(
|
|
@@ -137,12 +137,12 @@ declare module '../../index' {
|
|
|
137
137
|
*/
|
|
138
138
|
requestBackgroundPlayback(): void
|
|
139
139
|
/** 进入全屏
|
|
140
|
-
* @supported weapp, h5, rn
|
|
140
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
141
141
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestFullScreen.html
|
|
142
142
|
*/
|
|
143
143
|
requestFullScreen(option: VideoContext.RequestFullScreenOption): void
|
|
144
144
|
/** 跳转到指定位置
|
|
145
|
-
* @supported weapp, h5, rn
|
|
145
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
146
146
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.seek.html
|
|
147
147
|
*/
|
|
148
148
|
seek(
|
|
@@ -163,7 +163,7 @@ declare module '../../index' {
|
|
|
163
163
|
*/
|
|
164
164
|
showStatusBar(): void
|
|
165
165
|
/** 停止视频
|
|
166
|
-
* @supported weapp, h5, rn
|
|
166
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
167
167
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.stop.html
|
|
168
168
|
*/
|
|
169
169
|
stop(): void
|
|
@@ -414,7 +414,7 @@ declare module '../../index' {
|
|
|
414
414
|
openVideoEditor(option: openVideoEditor.Option): Promise<openVideoEditor.SuccessCallbackResult>
|
|
415
415
|
|
|
416
416
|
/** 获取视频详细信息
|
|
417
|
-
* @supported weapp
|
|
417
|
+
* @supported weapp, harmony_hybrid
|
|
418
418
|
* @example
|
|
419
419
|
* ```tsx
|
|
420
420
|
* Taro.downloadFile({
|
|
@@ -442,7 +442,7 @@ declare module '../../index' {
|
|
|
442
442
|
getVideoInfo(option: getVideoInfo.Option): Promise<getVideoInfo.SuccessCallbackResult>
|
|
443
443
|
|
|
444
444
|
/** 创建 video 上下文 VideoContext 对象。
|
|
445
|
-
* @supported weapp, h5, rn
|
|
445
|
+
* @supported weapp, h5, rn, harmony_hybrid
|
|
446
446
|
* @example
|
|
447
447
|
* ```tsx
|
|
448
448
|
* videoContext = Taro.createVideoContext('myVideo')
|
|
@@ -505,7 +505,7 @@ declare module '../../index' {
|
|
|
505
505
|
chooseVideo(option: chooseVideo.Option): Promise<chooseVideo.SuccessCallbackResult>
|
|
506
506
|
|
|
507
507
|
/** 拍摄或从手机相册中选择图片或视频。
|
|
508
|
-
* @supported weapp, h5
|
|
508
|
+
* @supported weapp, h5, harmony_hybrid
|
|
509
509
|
* @example
|
|
510
510
|
* ```tsx
|
|
511
511
|
* Taro.chooseMedia({
|
|
@@ -241,7 +241,7 @@ declare module '../../index' {
|
|
|
241
241
|
* **关于调试**
|
|
242
242
|
* - 在开发者工具上调用此 API 并不会真实的跳转到另外的小程序,但是开发者工具会校验本次调用跳转是否成功。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
|
|
243
243
|
* - 开发者工具上支持被跳转的小程序处理接收参数的调试。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
|
|
244
|
-
* @supported weapp, tt
|
|
244
|
+
* @supported weapp, tt, harmony_hybrid
|
|
245
245
|
* @example
|
|
246
246
|
* ```tsx
|
|
247
247
|
* Taro.navigateToMiniProgram({
|
|
@@ -85,7 +85,7 @@ declare module '../../index' {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/** 一个可以监听下载进度变化事件,以及取消下载任务的对象
|
|
88
|
-
* @supported weapp, swan, alipay, h5, rn, tt
|
|
88
|
+
* @supported weapp, swan, alipay, h5, rn, tt, harmony_hybrid
|
|
89
89
|
* @example
|
|
90
90
|
* ```tsx
|
|
91
91
|
* const downloadTask = Taro.downloadFile({
|
|
@@ -109,12 +109,12 @@ declare module '../../index' {
|
|
|
109
109
|
*/
|
|
110
110
|
interface DownloadTask {
|
|
111
111
|
/** 中断下载任务
|
|
112
|
-
* @supported weapp, h5, tt
|
|
112
|
+
* @supported weapp, h5, tt, harmony_hybrid
|
|
113
113
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.abort.html
|
|
114
114
|
*/
|
|
115
115
|
abort(): void
|
|
116
116
|
/** 监听下载进度变化事件
|
|
117
|
-
* @supported weapp, h5, tt
|
|
117
|
+
* @supported weapp, h5, tt, harmony_hybrid
|
|
118
118
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onProgressUpdate.html
|
|
119
119
|
*/
|
|
120
120
|
onProgressUpdate(
|
|
@@ -122,7 +122,7 @@ declare module '../../index' {
|
|
|
122
122
|
callback: DownloadTask.OnProgressUpdateCallback,
|
|
123
123
|
): void
|
|
124
124
|
/** 取消监听下载进度变化事件
|
|
125
|
-
* @supported weapp, h5, tt
|
|
125
|
+
* @supported weapp, h5, tt, harmony_hybrid
|
|
126
126
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offProgressUpdate.html
|
|
127
127
|
*/
|
|
128
128
|
offProgressUpdate(
|
|
@@ -151,7 +151,7 @@ declare module '../../index' {
|
|
|
151
151
|
/** 下载文件资源到本地。客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径,单次下载允许的最大文件为 50MB。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
|
|
152
152
|
*
|
|
153
153
|
* 注意:请在服务端响应的 header 中指定合理的 `Content-Type` 字段,以保证客户端正确处理文件类型。
|
|
154
|
-
* @supported weapp, h5, alipay, swan, rn, tt
|
|
154
|
+
* @supported weapp, h5, alipay, swan, rn, tt, harmony_hybrid
|
|
155
155
|
* @example
|
|
156
156
|
* ```tsx
|
|
157
157
|
* Taro.downloadFile({
|
|
@@ -262,7 +262,7 @@ declare module '../../index' {
|
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
/** 网络请求任务对象
|
|
265
|
-
* @supported weapp, h5, rn, alipay, swan, tt, qq
|
|
265
|
+
* @supported weapp, h5, rn, alipay, swan, tt, qq, harmony_hybrid
|
|
266
266
|
* @example
|
|
267
267
|
* 回调函数(Callback)用法:
|
|
268
268
|
*
|
|
@@ -316,12 +316,12 @@ declare module '../../index' {
|
|
|
316
316
|
*/
|
|
317
317
|
interface RequestTask<T> extends Promise<request.SuccessCallbackResult<T>> {
|
|
318
318
|
/** 中断请求任务
|
|
319
|
-
* @supported weapp, tt
|
|
319
|
+
* @supported weapp, tt, harmony_hybrid
|
|
320
320
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.abort.html
|
|
321
321
|
*/
|
|
322
322
|
abort(): void
|
|
323
323
|
/** 监听 HTTP Response Header 事件。会比请求完成事件更早
|
|
324
|
-
* @supported weapp
|
|
324
|
+
* @supported weapp, harmony_hybrid
|
|
325
325
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onHeadersReceived.html
|
|
326
326
|
*/
|
|
327
327
|
onHeadersReceived(
|
|
@@ -329,7 +329,7 @@ declare module '../../index' {
|
|
|
329
329
|
callback: RequestTask.onHeadersReceived.Callback
|
|
330
330
|
): void
|
|
331
331
|
/** 取消监听 HTTP Response Header 事件
|
|
332
|
-
* @supported weapp
|
|
332
|
+
* @supported weapp, harmony_hybrid
|
|
333
333
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.offHeadersReceived.html
|
|
334
334
|
*/
|
|
335
335
|
offHeadersReceived(
|
|
@@ -400,7 +400,7 @@ declare module '../../index' {
|
|
|
400
400
|
* - 对于 `GET` 方法的数据,会将数据转换成 query string(`encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...`)
|
|
401
401
|
* - 对于 `POST` 方法且 `header['content-type']` 为 `application/json` 的数据,会对数据进行 JSON 序列化
|
|
402
402
|
* - 对于 `POST` 方法且 `header['content-type']` 为 `application/x-www-form-urlencoded` 的数据,会将数据转换成 query string `(encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...)`
|
|
403
|
-
* @supported weapp, h5, rn, alipay, swan, tt, qq, harmony
|
|
403
|
+
* @supported weapp, h5, rn, alipay, swan, tt, qq, harmony, harmony_hybrid
|
|
404
404
|
* @example
|
|
405
405
|
* ```tsx
|
|
406
406
|
* Taro.request({
|
|
@@ -84,7 +84,7 @@ declare module '../../index' {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/** 一个可以监听上传进度变化事件,以及取消上传任务的对象
|
|
87
|
-
* @supported weapp, swan, alipay, h5, rn, tt
|
|
87
|
+
* @supported weapp, swan, alipay, h5, rn, tt, harmony_hybrid
|
|
88
88
|
* @example
|
|
89
89
|
* ```tsx
|
|
90
90
|
* const uploadTask = Taro.uploadFile({
|
|
@@ -112,12 +112,12 @@ declare module '../../index' {
|
|
|
112
112
|
*/
|
|
113
113
|
interface UploadTask {
|
|
114
114
|
/** 中断上传任务
|
|
115
|
-
* @supported weapp, h5, tt
|
|
115
|
+
* @supported weapp, h5, tt, harmony_hybrid
|
|
116
116
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.abort.html
|
|
117
117
|
*/
|
|
118
118
|
abort(): void
|
|
119
119
|
/** 监听上传进度变化事件
|
|
120
|
-
* @supported weapp, h5, tt
|
|
120
|
+
* @supported weapp, h5, tt, harmony_hybrid
|
|
121
121
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onProgressUpdate.html
|
|
122
122
|
*/
|
|
123
123
|
onProgressUpdate(
|
|
@@ -125,7 +125,7 @@ declare module '../../index' {
|
|
|
125
125
|
callback: UploadTask.OnProgressUpdateCallback,
|
|
126
126
|
): void
|
|
127
127
|
/** 取消监听上传进度变化事件
|
|
128
|
-
* @supported weapp, h5, tt
|
|
128
|
+
* @supported weapp, h5, tt, harmony_hybrid
|
|
129
129
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offProgressUpdate.html
|
|
130
130
|
*/
|
|
131
131
|
offProgressUpdate(
|
|
@@ -133,7 +133,7 @@ declare module '../../index' {
|
|
|
133
133
|
callback: UploadTask.OnProgressUpdateCallback,
|
|
134
134
|
): void
|
|
135
135
|
/** 监听 HTTP Response Header 事件。会比请求完成事件更早
|
|
136
|
-
* @supported weapp, h5
|
|
136
|
+
* @supported weapp, h5, harmony_hybrid
|
|
137
137
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onHeadersReceived.html
|
|
138
138
|
*/
|
|
139
139
|
onHeadersReceived(
|
|
@@ -141,7 +141,7 @@ declare module '../../index' {
|
|
|
141
141
|
callback: UploadTask.OnHeadersReceivedCallback,
|
|
142
142
|
): void
|
|
143
143
|
/** 取消监听 HTTP Response Header 事件
|
|
144
|
-
* @supported weapp, h5
|
|
144
|
+
* @supported weapp, h5, harmony_hybrid
|
|
145
145
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offHeadersReceived.html
|
|
146
146
|
*/
|
|
147
147
|
offHeadersReceived(
|
|
@@ -152,7 +152,7 @@ declare module '../../index' {
|
|
|
152
152
|
|
|
153
153
|
interface TaroStatic {
|
|
154
154
|
/** 将本地资源上传到服务器。客户端发起一个 HTTPS POST 请求,其中 `content-type` 为 `multipart/form-data`。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
|
|
155
|
-
* @supported weapp, swan, alipay, h5, rn, tt
|
|
155
|
+
* @supported weapp, swan, alipay, h5, rn, tt, harmony_hybrid
|
|
156
156
|
* @example
|
|
157
157
|
* ```tsx
|
|
158
158
|
* Taro.chooseImage({
|
|
@@ -138,22 +138,22 @@ declare module '../../index' {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/** WebSocket 任务,可通过 [Taro.connectSocket()](/docs/apis/network/websocket/SocketTask) 接口创建返回。
|
|
141
|
-
* @supported weapp, h5, rn, alipay, swan
|
|
141
|
+
* @supported weapp, h5, rn, alipay, swan, harmony_hybrid
|
|
142
142
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html
|
|
143
143
|
*/
|
|
144
144
|
interface SocketTask {
|
|
145
145
|
/** 通过 WebSocket 连接发送数据
|
|
146
|
-
* @supported weapp, h5, rn, alipay, swan, tt
|
|
146
|
+
* @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
|
|
147
147
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.send.html
|
|
148
148
|
*/
|
|
149
149
|
send(option: SocketTask.SendOption): void
|
|
150
150
|
/** 关闭 WebSocket 连接
|
|
151
|
-
* @supported weapp, h5, rn, alipay, swan, tt
|
|
151
|
+
* @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
|
|
152
152
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.close.html
|
|
153
153
|
*/
|
|
154
154
|
close(option: SocketTask.CloseOption): void
|
|
155
155
|
/** 监听 WebSocket 连接打开事件
|
|
156
|
-
* @supported weapp, h5, rn, alipay, swan, tt
|
|
156
|
+
* @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
|
|
157
157
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onOpen.html
|
|
158
158
|
*/
|
|
159
159
|
onOpen(
|
|
@@ -161,7 +161,7 @@ declare module '../../index' {
|
|
|
161
161
|
callback: SocketTask.OnOpenCallback
|
|
162
162
|
): void
|
|
163
163
|
/** 监听 WebSocket 连接关闭事件
|
|
164
|
-
* @supported weapp, h5, rn, alipay, swan, tt
|
|
164
|
+
* @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
|
|
165
165
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onClose.html
|
|
166
166
|
*/
|
|
167
167
|
onClose(
|
|
@@ -169,7 +169,7 @@ declare module '../../index' {
|
|
|
169
169
|
callback: SocketTask.OnCloseCallback
|
|
170
170
|
): void
|
|
171
171
|
/** 监听 WebSocket 错误事件
|
|
172
|
-
* @supported weapp, h5, rn, alipay, swan, tt
|
|
172
|
+
* @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
|
|
173
173
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onError.html
|
|
174
174
|
*/
|
|
175
175
|
onError(
|
|
@@ -177,7 +177,7 @@ declare module '../../index' {
|
|
|
177
177
|
callback: SocketTask.OnErrorCallback
|
|
178
178
|
): void
|
|
179
179
|
/** 监听 WebSocket 接受到服务器的消息事件
|
|
180
|
-
* @supported weapp, h5, rn, alipay, swan, tt
|
|
180
|
+
* @supported weapp, h5, rn, alipay, swan, tt, harmony_hybrid
|
|
181
181
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onMessage.html
|
|
182
182
|
*/
|
|
183
183
|
onMessage<T = any>(
|
|
@@ -320,7 +320,7 @@ declare module '../../index' {
|
|
|
320
320
|
* **并发数**
|
|
321
321
|
* - 1.7.0 及以上版本,最多可以同时存在 5 个 WebSocket 连接。
|
|
322
322
|
* - 1.7.0 以下版本,一个小程序同时只能有一个 WebSocket 连接,如果当前已存在一个 WebSocket 连接,会自动关闭该连接,并重新创建一个 WebSocket 连接。
|
|
323
|
-
* @supported weapp, h5, rn, alipay, swan
|
|
323
|
+
* @supported weapp, h5, rn, alipay, swan, harmony_hybrid
|
|
324
324
|
* @example
|
|
325
325
|
* ```tsx
|
|
326
326
|
* Taro.connectSocket({
|