@tarojs/taro 3.4.0-beta.2 → 3.4.2
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 +5 -7
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/visionkit.d.ts +303 -0
- package/types/api/base/crypto.d.ts +90 -0
- package/types/api/base/debug.d.ts +152 -13
- package/types/api/base/env.d.ts +2 -1
- package/types/api/base/index.d.ts +10 -2
- package/types/api/base/performance.d.ts +195 -0
- package/types/api/base/system.d.ts +539 -101
- package/types/api/base/update.d.ts +59 -7
- package/types/api/base/weapp/app-event.d.ts +49 -26
- package/types/api/base/weapp/life-cycle.d.ts +141 -1
- package/types/api/canvas/index.d.ts +171 -136
- package/types/api/cloud/index.d.ts +2 -2
- package/types/api/device/accelerometer.d.ts +3 -3
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +2 -2
- package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +67 -2
- package/types/api/device/calendar.d.ts +88 -0
- package/types/api/device/contact.d.ts +74 -50
- package/types/api/device/gyroscope.d.ts +5 -5
- package/types/api/device/iBeacon.d.ts +33 -19
- package/types/api/{ui → device}/keyboard.d.ts +0 -0
- package/types/api/device/{performance.d.ts → memory.d.ts} +4 -4
- package/types/api/device/motion.d.ts +3 -3
- package/types/api/device/network.d.ts +53 -12
- package/types/api/device/nfc.d.ts +1089 -13
- package/types/api/device/scan.d.ts +1 -1
- package/types/api/device/screen.d.ts +40 -12
- package/types/api/device/wifi.d.ts +41 -6
- package/types/api/files/index.d.ts +371 -184
- package/types/api/location/index.d.ts +116 -55
- package/types/api/media/audio.d.ts +653 -60
- package/types/api/media/background-audio.d.ts +47 -41
- package/types/api/media/camera.d.ts +38 -19
- package/types/api/media/editor.d.ts +22 -2
- package/types/api/media/image.d.ts +54 -105
- package/types/api/media/live.d.ts +66 -6
- package/types/api/media/map.d.ts +469 -49
- package/types/api/media/media-recorder.d.ts +92 -0
- package/types/api/media/recorder.d.ts +20 -20
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +11 -7
- package/types/api/media/video.d.ts +327 -39
- package/types/api/media/voip.d.ts +290 -0
- package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +63 -27
- package/types/api/network/download.d.ts +39 -16
- package/types/api/network/request.d.ts +143 -38
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +154 -83
- package/types/api/network/upload.d.ts +41 -25
- package/types/api/network/websocket.d.ts +16 -15
- package/types/api/open-api/authorize.d.ts +41 -2
- package/types/api/open-api/channels.d.ts +178 -0
- package/types/api/open-api/customer-service.d.ts +1 -1
- package/types/api/open-api/facial.d.ts +3 -0
- package/types/api/open-api/favorites.d.ts +100 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +2 -2
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +21 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +76 -14
- package/types/api/open-api/soter.d.ts +2 -2
- package/types/api/open-api/subscribe-message.d.ts +88 -3
- package/types/api/open-api/user-info.d.ts +55 -18
- package/types/api/open-api/werun.d.ts +33 -6
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/route/index.d.ts +13 -9
- package/types/api/share/index.d.ts +192 -9
- package/types/api/storage/index.d.ts +29 -83
- package/types/api/swan/index.d.ts +1 -1
- package/types/api/ui/animation.d.ts +84 -70
- package/types/api/ui/background.d.ts +4 -2
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +27 -31
- package/types/api/ui/navigation-bar.d.ts +1 -0
- package/types/api/ui/scroll.d.ts +73 -7
- package/types/api/ui/sticky.d.ts +4 -4
- package/types/api/ui/tab-bar.d.ts +7 -7
- package/types/api/ui/window.d.ts +22 -2
- package/types/api/worker/index.d.ts +9 -1
- package/types/api/wxml/index.d.ts +143 -105
- package/types/compile.d.ts +111 -106
- package/types/global.d.ts +142 -111
- package/types/taro.api.d.ts +79 -62
- package/types/taro.component.d.ts +82 -60
- package/types/taro.config.d.ts +174 -170
- package/types/taro.extend.d.ts +0 -17
- package/types/taro.hooks.d.ts +12 -12
- package/types/taro.lifecycle.d.ts +7 -0
- package/h5.js +0 -4
- package/types/api/open-api/payment.d.ts +0 -61
|
@@ -72,11 +72,11 @@ declare module '../../index' {
|
|
|
72
72
|
/** 选定音频的长度(单位:s),只有在音乐播放中时返回 */
|
|
73
73
|
duration: number
|
|
74
74
|
/** 播放状态 */
|
|
75
|
-
status: keyof
|
|
75
|
+
status: keyof Status
|
|
76
76
|
/** 调用结果 */
|
|
77
77
|
errMsg: string
|
|
78
78
|
}
|
|
79
|
-
interface
|
|
79
|
+
interface Status {
|
|
80
80
|
/** 暂停中 */
|
|
81
81
|
0
|
|
82
82
|
/** 播放中 */
|
|
@@ -86,84 +86,90 @@ declare module '../../index' {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
/** BackgroundAudioManager 实例,可通过 [Taro.getBackgroundAudioManager](
|
|
89
|
+
/** BackgroundAudioManager 实例,可通过 [Taro.getBackgroundAudioManager](/docs/apis/media/background-audio/getBackgroundAudioManager) 获取。
|
|
90
90
|
* @example
|
|
91
91
|
* ```tsx
|
|
92
92
|
* const backgroundAudioManager = Taro.getBackgroundAudioManager()
|
|
93
93
|
* backgroundAudioManager.title = '此时此刻'
|
|
94
94
|
* backgroundAudioManager.epname = '此时此刻'
|
|
95
95
|
* backgroundAudioManager.singer = '许巍'
|
|
96
|
-
* backgroundAudioManager.coverImgUrl = '
|
|
96
|
+
* backgroundAudioManager.coverImgUrl = 'https://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000'
|
|
97
97
|
* // 设置了 src 之后会自动播放
|
|
98
|
-
* backgroundAudioManager.src = '
|
|
98
|
+
* backgroundAudioManager.src = 'https://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
|
|
99
99
|
* ```
|
|
100
100
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.html
|
|
101
101
|
*/
|
|
102
102
|
interface BackgroundAudioManager {
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
/** 音频的数据源([2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持云文件ID)。默认为空字符串,**当设置了新的 src 时,会自动开始播放**,目前支持的格式有 m4a, aac, mp3, wav。 */
|
|
104
|
+
src: string
|
|
105
|
+
/** 音频开始播放的位置(单位:s)。 */
|
|
106
|
+
startTime: number
|
|
107
|
+
/** 音频标题,用于原生音频播放器音频标题(必填)。原生音频播放器中的分享功能,分享出去的卡片标题,也将使用该值。 */
|
|
108
|
+
title: string
|
|
109
|
+
/** 专辑名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
|
|
110
|
+
epname: string
|
|
111
|
+
/** 歌手名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
|
|
112
|
+
singer: string
|
|
107
113
|
/** 封面图 URL,用于做原生音频播放器背景图。原生音频播放器中的分享功能,分享出去的卡片配图及背景也将使用该图。 */
|
|
108
114
|
coverImgUrl: string
|
|
109
|
-
/**
|
|
110
|
-
|
|
115
|
+
/** 页面链接,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
|
|
116
|
+
webUrl: string
|
|
117
|
+
/** 音频协议。默认值为 'http',设置 'hls' 可以支持播放 HLS 协议的直播音频。 */
|
|
118
|
+
protocol: string
|
|
119
|
+
/** 播放速度。范围 0.5-2.0。
|
|
120
|
+
* @default 1
|
|
111
121
|
*/
|
|
112
|
-
|
|
122
|
+
playbackRate?: number
|
|
113
123
|
/** 当前音频的长度(单位:s),只有在有合法 src 时返回。
|
|
114
124
|
* @readonly
|
|
115
125
|
*/
|
|
116
126
|
duration: number
|
|
117
|
-
/**
|
|
118
|
-
|
|
127
|
+
/** 当前音频的播放位置(单位:s),只有在有合法 src 时返回。
|
|
128
|
+
* @readonly
|
|
129
|
+
*/
|
|
130
|
+
currentTime: number
|
|
119
131
|
/** 当前是否暂停或停止。
|
|
120
132
|
* @readonly
|
|
121
133
|
*/
|
|
122
134
|
paused: boolean
|
|
123
|
-
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
|
|
129
|
-
/** 音频开始播放的位置(单位:s)。 */
|
|
130
|
-
startTime: number
|
|
131
|
-
/** 音频标题,用于原生音频播放器音频标题(必填)。原生音频播放器中的分享功能,分享出去的卡片标题,也将使用该值。 */
|
|
132
|
-
title: string
|
|
133
|
-
/** 页面链接,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
|
|
134
|
-
webUrl: string
|
|
135
|
+
/** 音频已缓冲的时间,仅保证当前播放时间点到此时间点内容已缓冲。
|
|
136
|
+
* @readonly
|
|
137
|
+
*/
|
|
138
|
+
buffered: number
|
|
139
|
+
/** origin: 发送完整的 referrer; no-referrer: 不发送 */
|
|
140
|
+
referrerPolicy?: 'origin' | 'no-referrer' | string
|
|
135
141
|
/** 播放 */
|
|
136
142
|
play(): void
|
|
137
143
|
/** 暂停 */
|
|
138
144
|
pause(): void
|
|
139
|
-
/** 停止 */
|
|
140
|
-
stop(): void
|
|
141
145
|
/** 跳转到指定位置,单位 s */
|
|
142
146
|
seek(position: any): void
|
|
147
|
+
/** 停止 */
|
|
148
|
+
stop(): void
|
|
143
149
|
/** 背景音频进入可以播放状态,但不保证后面可以流畅播放 */
|
|
144
150
|
onCanplay(callback?: () => void): void
|
|
151
|
+
/** 音频加载中事件,当音频因为数据不足,需要停下来加载时会触发 */
|
|
152
|
+
onWaiting(callback?: () => void): void
|
|
153
|
+
/** 背景音频播放错误事件 */
|
|
154
|
+
onError(callback?: () => void): void
|
|
145
155
|
/** 背景音频播放事件 */
|
|
146
156
|
onPlay(callback?: () => void): void
|
|
147
157
|
/** 背景音频暂停事件 */
|
|
148
158
|
onPause(callback?: () => void): void
|
|
149
|
-
/**
|
|
150
|
-
|
|
159
|
+
/** 背景音频开始跳转操作事件 */
|
|
160
|
+
onSeeking(callback?: () => void): void
|
|
161
|
+
/** 背景音频完成跳转操作事件 */
|
|
162
|
+
onSeeked(callback?: () => void): void
|
|
151
163
|
/** 背景音频自然播放结束事件 */
|
|
152
164
|
onEnded(callback?: () => void): void
|
|
165
|
+
/** 背景音频停止事件 */
|
|
166
|
+
onStop(callback?: () => void): void
|
|
153
167
|
/** 背景音频播放进度更新事件 */
|
|
154
168
|
onTimeUpdate(callback?: () => void): void
|
|
155
169
|
/** 用户在系统音乐播放面板点击上一曲事件(iOS only) */
|
|
156
170
|
onPrev(callback?: () => void): void
|
|
157
171
|
/** 用户在系统音乐播放面板点击下一曲事件(iOS only) */
|
|
158
172
|
onNext(callback?: () => void): void
|
|
159
|
-
/** 背景音频播放错误事件 */
|
|
160
|
-
onError(callback?: () => void): void
|
|
161
|
-
/** 音频加载中事件,当音频因为数据不足,需要停下来加载时会触发 */
|
|
162
|
-
onWaiting(callback?: () => void): void
|
|
163
|
-
/** 背景音频开始跳转操作事件 */
|
|
164
|
-
onSeeking(callback?: () => void): void
|
|
165
|
-
/** 背景音频完成跳转操作事件 */
|
|
166
|
-
onSeeked(callback?: () => void): void
|
|
167
173
|
}
|
|
168
174
|
|
|
169
175
|
interface TaroStatic {
|
|
@@ -246,7 +252,7 @@ declare module '../../index' {
|
|
|
246
252
|
): void
|
|
247
253
|
|
|
248
254
|
/** 获取后台音乐播放状态。
|
|
249
|
-
* **注意:1.2.0 版本开始,本接口不再维护。建议使用能力更强的 [Taro.getBackgroundAudioManager](
|
|
255
|
+
* **注意:1.2.0 版本开始,本接口不再维护。建议使用能力更强的 [Taro.getBackgroundAudioManager](/docs/apis/media/background-audio/getBackgroundAudioManager) 接口**
|
|
250
256
|
* @supported weapp
|
|
251
257
|
* @example
|
|
252
258
|
* ```tsx
|
|
@@ -275,8 +281,8 @@ declare module '../../index' {
|
|
|
275
281
|
* backgroundAudioManager.title = '此时此刻'
|
|
276
282
|
* backgroundAudioManager.epname = '此时此刻'
|
|
277
283
|
* backgroundAudioManager.singer = '许巍'
|
|
278
|
-
* backgroundAudioManager.coverImgUrl = '
|
|
279
|
-
* backgroundAudioManager.src = '
|
|
284
|
+
* backgroundAudioManager.coverImgUrl = 'https://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000'
|
|
285
|
+
* backgroundAudioManager.src = 'https://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46' // 设置了 src 之后会自动播放
|
|
280
286
|
* ```
|
|
281
287
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html
|
|
282
288
|
*/
|
|
@@ -5,26 +5,11 @@ declare module '../../index' {
|
|
|
5
5
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.html
|
|
6
6
|
*/
|
|
7
7
|
interface CameraContext {
|
|
8
|
-
/** 开始录像
|
|
9
|
-
* @supported weapp
|
|
10
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.startRecord.html
|
|
11
|
-
*/
|
|
12
|
-
startRecord(option: CameraContext.StartRecordOption): void
|
|
13
|
-
/** 结束录像
|
|
14
|
-
* @supported weapp
|
|
15
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.stopRecord.html
|
|
16
|
-
*/
|
|
17
|
-
stopRecord(option?: CameraContext.StopRecordOption): void
|
|
18
|
-
/** 拍摄照片
|
|
19
|
-
* @supported weapp
|
|
20
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.takePhoto.html
|
|
21
|
-
*/
|
|
22
|
-
takePhoto(option: CameraContext.TakePhotoOption): void
|
|
23
8
|
/** 获取 Camera 实时帧数据
|
|
24
9
|
*
|
|
25
10
|
* ****
|
|
26
11
|
*
|
|
27
|
-
* 注: 使用该接口需同时在 [camera](
|
|
12
|
+
* 注: 使用该接口需同时在 [camera](/docs/components/media/camera) 组件属性中指定 frame-size。
|
|
28
13
|
* @supported weapp
|
|
29
14
|
* @example
|
|
30
15
|
* ```tsx
|
|
@@ -40,9 +25,43 @@ declare module '../../index' {
|
|
|
40
25
|
/** 回调函数 */
|
|
41
26
|
callback: CameraContext.OnCameraFrameCallback,
|
|
42
27
|
): CameraFrameListener
|
|
28
|
+
/** 设置缩放级别
|
|
29
|
+
* @supported weapp
|
|
30
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.setZoom.html
|
|
31
|
+
*/
|
|
32
|
+
setZoom(option: CameraContext.SetZoomOption): void
|
|
33
|
+
/** 开始录像
|
|
34
|
+
* @supported weapp, rn
|
|
35
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.startRecord.html
|
|
36
|
+
*/
|
|
37
|
+
startRecord(option: CameraContext.StartRecordOption): void
|
|
38
|
+
/** 结束录像
|
|
39
|
+
* @supported weapp, rn
|
|
40
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.stopRecord.html
|
|
41
|
+
*/
|
|
42
|
+
stopRecord(option?: CameraContext.StopRecordOption): void
|
|
43
|
+
/** 拍摄照片
|
|
44
|
+
* @supported weapp, rn
|
|
45
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.takePhoto.html
|
|
46
|
+
*/
|
|
47
|
+
takePhoto(option: CameraContext.TakePhotoOption): void
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
namespace CameraContext {
|
|
51
|
+
interface SetZoomOption {
|
|
52
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
53
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
54
|
+
/** 接口调用失败的回调函数 */
|
|
55
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
56
|
+
/** 接口调用成功的回调函数 */
|
|
57
|
+
success?: (res: StartRecordSuccessCallbackResult) => void
|
|
58
|
+
/** 缩放级别,范围[1, maxZoom]。zoom 可取小数,精确到小数后一位。maxZoom 可在 bindinitdone 返回值中获取。 */
|
|
59
|
+
zoom: number
|
|
60
|
+
}
|
|
61
|
+
interface StartRecordSuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
62
|
+
/** 实际设置的缩放级别。由于系统限制,某些机型可能无法设置成指定值,会改用最接近的可设值。 */
|
|
63
|
+
zoom: number
|
|
64
|
+
}
|
|
46
65
|
interface StartRecordOption {
|
|
47
66
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
48
67
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
@@ -85,7 +104,7 @@ declare module '../../index' {
|
|
|
85
104
|
/** 接口调用失败的回调函数 */
|
|
86
105
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
87
106
|
/** 成像质量 */
|
|
88
|
-
quality?: keyof
|
|
107
|
+
quality?: keyof Quality
|
|
89
108
|
/** 接口调用成功的回调函数 */
|
|
90
109
|
success?: (result: TakePhotoSuccessCallbackResult) => void
|
|
91
110
|
}
|
|
@@ -105,7 +124,7 @@ declare module '../../index' {
|
|
|
105
124
|
/** 图像数据矩形的宽度 */
|
|
106
125
|
width: number
|
|
107
126
|
}
|
|
108
|
-
interface
|
|
127
|
+
interface Quality {
|
|
109
128
|
/** 高质量 */
|
|
110
129
|
high
|
|
111
130
|
/** 普通质量 */
|
|
@@ -152,7 +171,7 @@ declare module '../../index' {
|
|
|
152
171
|
|
|
153
172
|
interface TaroStatic {
|
|
154
173
|
/** 创建 camera 上下文 CameraContext 对象。
|
|
155
|
-
* @supported weapp
|
|
174
|
+
* @supported weapp, rn
|
|
156
175
|
* @example
|
|
157
176
|
* ```tsx
|
|
158
177
|
* const cameraContext = Taro.createCameraContext()
|
|
@@ -3,6 +3,7 @@ import Taro from '../../index'
|
|
|
3
3
|
declare module '../../index' {
|
|
4
4
|
/** `EditorContext` 实例,可通过 `Taro.createSelectorQuery` 获取。
|
|
5
5
|
* `EditorContext` 通过 `id` 跟一个 `editor` 组件绑定,操作对应的 `editor` 组件。
|
|
6
|
+
* @supported weapp
|
|
6
7
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.html
|
|
7
8
|
*/
|
|
8
9
|
interface EditorContext {
|
|
@@ -59,6 +60,11 @@ declare module '../../index' {
|
|
|
59
60
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getContents.html
|
|
60
61
|
*/
|
|
61
62
|
getContents(option?: EditorContext.GetContentsOption): void
|
|
63
|
+
/** 获取编辑器已选区域内的纯文本内容。当编辑器失焦或未选中一段区间时,返回内容为空。
|
|
64
|
+
* @supported weapp
|
|
65
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getSelectionText.html
|
|
66
|
+
*/
|
|
67
|
+
getSelectionText(option?: EditorContext.getSelectionText.Option): void
|
|
62
68
|
/** 插入分割线
|
|
63
69
|
* @supported weapp
|
|
64
70
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertDivider.html
|
|
@@ -66,9 +72,9 @@ declare module '../../index' {
|
|
|
66
72
|
insertDivider(option?: EditorContext.InsertDividerOption): void
|
|
67
73
|
/** 插入图片。
|
|
68
74
|
*
|
|
69
|
-
* 地址为临时文件时,获取的编辑器html格式内容中
|
|
75
|
+
* 地址为临时文件时,获取的编辑器html格式内容中 `<img>` 标签增加属性 data-local,delta 格式内容中图片 attributes 属性增加 data-local 字段,该值为传入的临时文件地址。
|
|
70
76
|
*
|
|
71
|
-
* 开发者可选择在提交阶段上传图片到服务器,获取到网络地址后进行替换。替换时对于html内容应替换掉
|
|
77
|
+
* 开发者可选择在提交阶段上传图片到服务器,获取到网络地址后进行替换。替换时对于html内容应替换掉 `<img>` 的 src 值,对于 delta 内容应替换掉 `insert { image: abc }` 值。
|
|
72
78
|
* @supported weapp
|
|
73
79
|
* @example
|
|
74
80
|
* ```tsx
|
|
@@ -139,6 +145,20 @@ declare module '../../index' {
|
|
|
139
145
|
/** 接口调用成功的回调函数 */
|
|
140
146
|
success?: (res: TaroGeneral.CallbackResult) => void
|
|
141
147
|
}
|
|
148
|
+
namespace getSelectionText {
|
|
149
|
+
interface Option {
|
|
150
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
151
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
152
|
+
/** 接口调用失败的回调函数 */
|
|
153
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
154
|
+
/** 接口调用成功的回调函数 */
|
|
155
|
+
success?: (res: SuccessCallbackResult) => void
|
|
156
|
+
}
|
|
157
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
158
|
+
/** 纯文本内容 */
|
|
159
|
+
text: string
|
|
160
|
+
}
|
|
161
|
+
}
|
|
142
162
|
interface InsertDividerOption {
|
|
143
163
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
144
164
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
@@ -77,7 +77,7 @@ declare module '../../index' {
|
|
|
77
77
|
/** [拍照时设备方向](http://sylvana.net/jpegcrop/exif_orientation.html)
|
|
78
78
|
* @default "up"
|
|
79
79
|
*/
|
|
80
|
-
orientation: keyof
|
|
80
|
+
orientation: keyof Orientation
|
|
81
81
|
/** 图片的本地路径 */
|
|
82
82
|
path: string
|
|
83
83
|
/** 图片格式 */
|
|
@@ -88,7 +88,7 @@ declare module '../../index' {
|
|
|
88
88
|
errMsg: string
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
interface
|
|
91
|
+
interface Orientation {
|
|
92
92
|
/** 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。 */
|
|
93
93
|
'up'
|
|
94
94
|
/** 同 up,但镜像翻转,对应 Exif 中的 2 */
|
|
@@ -108,6 +108,23 @@ declare module '../../index' {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
namespace editImage {
|
|
112
|
+
interface Option {
|
|
113
|
+
/** 图片路径,图片的路径,支持本地路径、代码包路径 */
|
|
114
|
+
src: string
|
|
115
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
116
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
117
|
+
/** 接口调用失败的回调函数 */
|
|
118
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
119
|
+
/** 接口调用成功的回调函数 */
|
|
120
|
+
success?: (result: SuccessCallbackResult) => void
|
|
121
|
+
}
|
|
122
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
123
|
+
/** 编辑后图片的临时文件路径 (本地路径) */
|
|
124
|
+
tempFilePath: string
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
111
128
|
namespace chooseImage {
|
|
112
129
|
interface Option {
|
|
113
130
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
@@ -202,7 +219,7 @@ declare module '../../index' {
|
|
|
202
219
|
/** 接口调用成功的回调函数 */
|
|
203
220
|
success?: (result: SuccessCallbackResult) => void
|
|
204
221
|
/** 所选的文件的类型 */
|
|
205
|
-
type?: keyof
|
|
222
|
+
type?: keyof SelectType
|
|
206
223
|
}
|
|
207
224
|
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
208
225
|
/** 返回选择的文件的本地临时文件对象数组 */
|
|
@@ -221,9 +238,9 @@ declare module '../../index' {
|
|
|
221
238
|
/** 选择的文件的会话发送时间,Unix时间戳,工具暂不支持此属性 */
|
|
222
239
|
time: number
|
|
223
240
|
/** 选择的文件类型 */
|
|
224
|
-
type: keyof
|
|
241
|
+
type: keyof SelectedType
|
|
225
242
|
}
|
|
226
|
-
interface
|
|
243
|
+
interface SelectType {
|
|
227
244
|
/** 从所有文件选择 */
|
|
228
245
|
all
|
|
229
246
|
/** 只能选择视频文件 */
|
|
@@ -233,7 +250,7 @@ declare module '../../index' {
|
|
|
233
250
|
/** 可以选择除了图片和视频之外的其它的文件 */
|
|
234
251
|
file
|
|
235
252
|
}
|
|
236
|
-
interface
|
|
253
|
+
interface SelectedType {
|
|
237
254
|
/** 选择了视频文件 */
|
|
238
255
|
video
|
|
239
256
|
/** 选择了图片文件 */
|
|
@@ -243,66 +260,6 @@ declare module '../../index' {
|
|
|
243
260
|
}
|
|
244
261
|
}
|
|
245
262
|
|
|
246
|
-
namespace chooseMedia {
|
|
247
|
-
interface Option {
|
|
248
|
-
/** 最多可以选择的文件个数 */
|
|
249
|
-
count?: number
|
|
250
|
-
/** 文件类型 */
|
|
251
|
-
mediaType?: Array<keyof mediaType>
|
|
252
|
-
/** 图片和视频选择的来源 */
|
|
253
|
-
sourceType?: Array<keyof sourceType>
|
|
254
|
-
/** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 30s 之间 */
|
|
255
|
-
maxDuration?: number
|
|
256
|
-
/** 仅对 mediaType 为 image 时有效,是否压缩所选文件 */
|
|
257
|
-
sizeType?: Array<'original' | 'compressed'>
|
|
258
|
-
/** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头 */
|
|
259
|
-
camera?: string
|
|
260
|
-
/** 接口调用失败的回调函数 */
|
|
261
|
-
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
262
|
-
/** 接口调用成功的回调函数 */
|
|
263
|
-
success?: (result: SuccessCallbackResult) => void
|
|
264
|
-
}
|
|
265
|
-
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
266
|
-
/** 本地临时文件列表 */
|
|
267
|
-
tempFiles: ChooseMedia[]
|
|
268
|
-
/** 文件类型,有效值有 image 、video */
|
|
269
|
-
type: string
|
|
270
|
-
}
|
|
271
|
-
/** 本地临时文件列表 */
|
|
272
|
-
interface ChooseMedia {
|
|
273
|
-
/** 本地临时文件路径 (本地路径) */
|
|
274
|
-
tempFilePath: string
|
|
275
|
-
/** 本地临时文件大小,单位 B */
|
|
276
|
-
size: number
|
|
277
|
-
/** 视频的时间长度 */
|
|
278
|
-
duration: number
|
|
279
|
-
/** 视频的高度 */
|
|
280
|
-
height: number
|
|
281
|
-
/** 视频的宽度 */
|
|
282
|
-
width: number
|
|
283
|
-
/** 视频缩略图临时文件路径 */
|
|
284
|
-
thumbTempFilePath: string
|
|
285
|
-
}
|
|
286
|
-
interface mediaType {
|
|
287
|
-
/** 只能拍摄视频或从相册选择视频 */
|
|
288
|
-
video
|
|
289
|
-
/** 只能拍摄图片或从相册选择图片 */
|
|
290
|
-
image
|
|
291
|
-
}
|
|
292
|
-
interface sourceType {
|
|
293
|
-
/** 从相册选择 */
|
|
294
|
-
album
|
|
295
|
-
/** 使用相机拍摄 */
|
|
296
|
-
camera
|
|
297
|
-
}
|
|
298
|
-
interface camera {
|
|
299
|
-
/** 使用后置摄像头 */
|
|
300
|
-
back
|
|
301
|
-
/** 使用前置摄像头 */
|
|
302
|
-
front
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
263
|
interface TaroStatic {
|
|
307
264
|
/** 保存图片到系统相册。需要[用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.writePhotosAlbum
|
|
308
265
|
* @supported weapp, rn, alipay, swan
|
|
@@ -316,6 +273,18 @@ declare module '../../index' {
|
|
|
316
273
|
*/
|
|
317
274
|
saveImageToPhotosAlbum(option: saveImageToPhotosAlbum.Option): Promise<TaroGeneral.CallbackResult>
|
|
318
275
|
|
|
276
|
+
/** 预览图片和视频。
|
|
277
|
+
* @supported weapp
|
|
278
|
+
* @example
|
|
279
|
+
* ```tsx
|
|
280
|
+
* Taro.previewMedia({
|
|
281
|
+
* sources: []
|
|
282
|
+
* })
|
|
283
|
+
* ```
|
|
284
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewMedia.html
|
|
285
|
+
*/
|
|
286
|
+
previewMedia(option: previewMedia.Option): Promise<TaroGeneral.CallbackResult>
|
|
287
|
+
|
|
319
288
|
/** 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
|
|
320
289
|
* @supported weapp, h5, rn, alipay, swan
|
|
321
290
|
* @example
|
|
@@ -329,18 +298,6 @@ declare module '../../index' {
|
|
|
329
298
|
*/
|
|
330
299
|
previewImage(option: previewImage.Option): Promise<TaroGeneral.CallbackResult>
|
|
331
300
|
|
|
332
|
-
/** 预览图片和视频。
|
|
333
|
-
* @supported weapp 基础库 2.12.0 开始支持,低版本需做兼容处理。
|
|
334
|
-
* @example
|
|
335
|
-
* ```tsx
|
|
336
|
-
* Taro.previewMedia({
|
|
337
|
-
* sources: []
|
|
338
|
-
* })
|
|
339
|
-
* ```
|
|
340
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewMedia.html
|
|
341
|
-
*/
|
|
342
|
-
previewMedia(option: previewMedia.Option): Promise<TaroGeneral.CallbackResult>
|
|
343
|
-
|
|
344
301
|
/** 获取图片信息。网络图片需先配置download域名才能生效。
|
|
345
302
|
* @supported weapp, h5, rn, alipay, swan
|
|
346
303
|
* @example
|
|
@@ -368,27 +325,20 @@ declare module '../../index' {
|
|
|
368
325
|
*/
|
|
369
326
|
getImageInfo(option: getImageInfo.Option): Promise<getImageInfo.SuccessCallbackResult>
|
|
370
327
|
|
|
371
|
-
/**
|
|
372
|
-
*
|
|
373
|
-
* @supported weapp, h5, rn, alipay, swan
|
|
328
|
+
/** 编辑图片接口
|
|
329
|
+
* @supported weapp
|
|
374
330
|
* @example
|
|
375
331
|
* ```tsx
|
|
376
|
-
* Taro.
|
|
377
|
-
*
|
|
378
|
-
* sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
379
|
-
* sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有,在H5浏览器端支持使用 `user` 和 `environment`分别指定为前后摄像头
|
|
380
|
-
* success: function (res) {
|
|
381
|
-
* // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
|
|
382
|
-
* var tempFilePaths = res.tempFilePaths
|
|
383
|
-
* }
|
|
332
|
+
* Taro.editImage({
|
|
333
|
+
* src: '', // 图片路径
|
|
384
334
|
* })
|
|
385
335
|
* ```
|
|
386
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.
|
|
336
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.editImage.html
|
|
387
337
|
*/
|
|
388
|
-
|
|
338
|
+
editImage(option: editImage.Option): Promise<editImage.SuccessCallbackResult>
|
|
389
339
|
|
|
390
340
|
/** 压缩图片接口,可选压缩质量
|
|
391
|
-
* @supported weapp
|
|
341
|
+
* @supported weapp, rn
|
|
392
342
|
* @example
|
|
393
343
|
* ```tsx
|
|
394
344
|
* Taro.compressImage({
|
|
@@ -417,24 +367,23 @@ declare module '../../index' {
|
|
|
417
367
|
*/
|
|
418
368
|
chooseMessageFile(option: chooseMessageFile.Option): Promise<chooseMessageFile.SuccessCallbackResult>
|
|
419
369
|
|
|
420
|
-
/**
|
|
421
|
-
*
|
|
370
|
+
/**
|
|
371
|
+
* 从本地相册选择图片或使用相机拍照。
|
|
372
|
+
* @supported weapp, h5, rn, alipay, swan
|
|
422
373
|
* @example
|
|
423
374
|
* ```tsx
|
|
424
|
-
* Taro.
|
|
425
|
-
* count: 9
|
|
426
|
-
*
|
|
427
|
-
* sourceType: ['album', 'camera'],
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
* console.log(res.tempFiles)
|
|
432
|
-
* console.log(res.type)
|
|
375
|
+
* Taro.chooseImage({
|
|
376
|
+
* count: 1, // 默认9
|
|
377
|
+
* sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
378
|
+
* sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有,在H5浏览器端支持使用 `user` 和 `environment`分别指定为前后摄像头
|
|
379
|
+
* success: function (res) {
|
|
380
|
+
* // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
|
|
381
|
+
* var tempFilePaths = res.tempFilePaths
|
|
433
382
|
* }
|
|
434
383
|
* })
|
|
435
384
|
* ```
|
|
436
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/
|
|
385
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html
|
|
437
386
|
*/
|
|
438
|
-
|
|
387
|
+
chooseImage(option: chooseImage.Option): Promise<chooseImage.SuccessCallbackResult>
|
|
439
388
|
}
|
|
440
389
|
}
|