@tarojs/taro 3.3.12 → 3.4.0-beta.0
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 -5
- package/types/api/ad/index.d.ts +34 -28
- package/types/api/alipay/index.d.ts +11 -7
- package/types/api/base/debug.d.ts +60 -54
- package/types/api/base/env.d.ts +12 -8
- package/types/api/base/index.d.ts +87 -83
- package/types/api/base/system.d.ts +59 -54
- package/types/api/base/update.d.ts +37 -33
- package/types/api/base/weapp/app-event.d.ts +147 -131
- package/types/api/base/weapp/life-cycle.d.ts +14 -10
- package/types/api/canvas/index.d.ts +115 -110
- package/types/api/cloud/index.d.ts +99 -94
- package/types/api/data-analysis/index.d.ts +68 -64
- package/types/api/device/accelerometer.d.ts +57 -50
- package/types/api/device/battery.d.ts +19 -15
- package/types/api/device/ble.d.ts +241 -228
- package/types/api/device/bluetooth.d.ts +207 -194
- package/types/api/device/clipboard.d.ts +48 -43
- package/types/api/device/compass.d.ts +55 -48
- package/types/api/device/contact.d.ts +13 -9
- package/types/api/device/gyroscope.d.ts +41 -35
- package/types/api/device/iBeacon.d.ts +79 -73
- package/types/api/device/motion.d.ts +42 -37
- package/types/api/device/network.d.ts +80 -42
- package/types/api/device/nfc.d.ts +105 -96
- package/types/api/device/performance.d.ts +32 -18
- package/types/api/device/phone.d.ts +20 -15
- package/types/api/device/scan.d.ts +31 -26
- package/types/api/device/screen.d.ts +74 -67
- package/types/api/device/vibrate.d.ts +31 -25
- package/types/api/device/wifi.d.ts +151 -140
- package/types/api/ext/index.d.ts +44 -39
- package/types/api/files/index.d.ts +219 -209
- package/types/api/framework/index.d.ts +25 -20
- package/types/api/location/index.d.ts +140 -136
- package/types/api/media/audio.d.ts +135 -127
- package/types/api/media/background-audio.d.ts +135 -126
- package/types/api/media/camera.d.ts +30 -26
- package/types/api/media/editor.d.ts +35 -33
- package/types/api/media/image.d.ts +161 -150
- package/types/api/media/live.d.ts +88 -82
- package/types/api/media/map.d.ts +47 -43
- package/types/api/media/recorder.d.ts +90 -84
- package/types/api/media/video-processing.d.ts +10 -6
- package/types/api/media/video.d.ts +63 -58
- package/types/api/network/download.d.ts +34 -30
- package/types/api/network/mdns.d.ts +104 -91
- package/types/api/network/request.d.ts +83 -79
- package/types/api/network/udp.d.ts +20 -16
- package/types/api/network/upload.d.ts +60 -56
- package/types/api/network/websocket.d.ts +201 -194
- package/types/api/open-api/account.d.ts +18 -14
- package/types/api/open-api/address.d.ts +27 -23
- package/types/api/open-api/authorize.d.ts +30 -26
- package/types/api/open-api/card.d.ts +55 -51
- package/types/api/open-api/customer-service.d.ts +21 -17
- package/types/api/open-api/facial.d.ts +28 -24
- package/types/api/open-api/invoice.d.ts +38 -34
- package/types/api/open-api/login.d.ts +56 -52
- package/types/api/open-api/navigate.d.ts +79 -75
- package/types/api/open-api/payment.d.ts +34 -30
- package/types/api/open-api/settings.d.ts +49 -45
- package/types/api/open-api/soter.d.ts +92 -86
- package/types/api/open-api/subscribe-message.d.ts +24 -20
- package/types/api/open-api/user-info.d.ts +60 -57
- package/types/api/open-api/werun.d.ts +50 -46
- package/types/api/route/index.d.ts +122 -118
- package/types/api/share/index.d.ts +68 -64
- package/types/api/storage/background-fetch.d.ts +40 -35
- package/types/api/storage/index.d.ts +267 -262
- package/types/api/swan/index.d.ts +47 -42
- package/types/api/ui/animation.d.ts +21 -17
- package/types/api/ui/background.d.ts +38 -34
- package/types/api/ui/custom-component.d.ts +22 -18
- package/types/api/ui/fonts.d.ts +26 -21
- package/types/api/ui/interaction.d.ts +167 -121
- package/types/api/ui/keyboard.d.ts +59 -55
- package/types/api/ui/menu.d.ts +10 -6
- package/types/api/ui/navigation-bar.d.ts +67 -63
- package/types/api/ui/pull-down-refresh.d.ts +33 -29
- package/types/api/ui/scroll.d.ts +30 -26
- package/types/api/ui/sticky.d.ts +22 -19
- package/types/api/ui/tab-bar.d.ts +101 -97
- package/types/api/ui/window.d.ts +24 -18
- package/types/api/worker/index.d.ts +28 -24
- package/types/api/wxml/index.d.ts +42 -38
- package/types/global.d.ts +390 -0
- package/types/index.d.ts +12 -98
- package/types/taro.api.d.ts +94 -0
- package/types/taro.component.d.ts +10 -57
- package/types/taro.config.d.ts +24 -6
- package/types/taro.extend.d.ts +52 -75
- package/types/taro.hooks.d.ts +68 -67
- package/types/taro.lifecycle.d.ts +47 -28
- package/types/api/ad/index.ts +0 -6
- package/types/api/alipay/index.ts +0 -7
- package/types/api/index.d.ts +0 -352
|
@@ -1,27 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
2
4
|
namespace saveImageToPhotosAlbum {
|
|
3
5
|
interface Option {
|
|
4
6
|
/** 图片文件路径,可以是临时文件路径或永久文件路径,不支持网络图片路径 */
|
|
5
7
|
filePath: string
|
|
6
8
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
-
complete?: (res:
|
|
9
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
10
|
/** 接口调用失败的回调函数 */
|
|
9
|
-
fail?: (res:
|
|
11
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
12
|
/** 接口调用成功的回调函数 */
|
|
11
|
-
success?: (res:
|
|
13
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
|
-
/** 保存图片到系统相册。需要[用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.writePhotosAlbum
|
|
15
|
-
* @supported weapp, rn, alipay, swan
|
|
16
|
-
* @example
|
|
17
|
-
* ```tsx
|
|
18
|
-
* Taro.saveImageToPhotosAlbum({
|
|
19
|
-
* success: function (res) { }
|
|
20
|
-
* })
|
|
21
|
-
* ```
|
|
22
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html
|
|
23
|
-
*/
|
|
24
|
-
function saveImageToPhotosAlbum(option: saveImageToPhotosAlbum.Option): Promise<General.CallbackResult>
|
|
25
16
|
|
|
26
17
|
namespace previewImage {
|
|
27
18
|
interface Option {
|
|
@@ -34,25 +25,13 @@ declare namespace Taro {
|
|
|
34
25
|
/** @support weapp 最低版本:2.13.0。origin: 发送完整的referrer; no-referrer: 不发送。格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本;默认值:no-referrer */
|
|
35
26
|
referrerPolicy?: string
|
|
36
27
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
37
|
-
complete?: (res:
|
|
28
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
38
29
|
/** 接口调用失败的回调函数 */
|
|
39
|
-
fail?: (res:
|
|
30
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
40
31
|
/** 接口调用成功的回调函数 */
|
|
41
|
-
success?: (res:
|
|
32
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
42
33
|
}
|
|
43
34
|
}
|
|
44
|
-
/** 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
|
|
45
|
-
* @supported weapp, h5, rn, alipay, swan
|
|
46
|
-
* @example
|
|
47
|
-
* ```tsx
|
|
48
|
-
* Taro.previewImage({
|
|
49
|
-
* current: '', // 当前显示图片的http链接
|
|
50
|
-
* urls: [] // 需要预览的图片http链接列表
|
|
51
|
-
* })
|
|
52
|
-
* ```
|
|
53
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewImage.html
|
|
54
|
-
*/
|
|
55
|
-
function previewImage(option: previewImage.Option): Promise<General.CallbackResult>
|
|
56
35
|
|
|
57
36
|
namespace previewMedia {
|
|
58
37
|
interface Sources {
|
|
@@ -73,37 +52,26 @@ declare namespace Taro {
|
|
|
73
52
|
/** origin: 发送完整的referrer; no-referrer: 不发送。格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本;默认值:no-referrer */
|
|
74
53
|
referrerPolicy?: string
|
|
75
54
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
76
|
-
complete?: (res:
|
|
55
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
77
56
|
/** 接口调用失败的回调函数 */
|
|
78
|
-
fail?: (res:
|
|
57
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
79
58
|
/** 接口调用成功的回调函数 */
|
|
80
|
-
success?: (res:
|
|
59
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
81
60
|
}
|
|
82
61
|
}
|
|
83
|
-
/** 预览图片和视频。
|
|
84
|
-
* @supported weapp 基础库 2.12.0 开始支持,低版本需做兼容处理。
|
|
85
|
-
* @example
|
|
86
|
-
* ```tsx
|
|
87
|
-
* Taro.previewMedia({
|
|
88
|
-
* sources: []
|
|
89
|
-
* })
|
|
90
|
-
* ```
|
|
91
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewMedia.html
|
|
92
|
-
*/
|
|
93
|
-
function previewMedia(option: previewMedia.Option): Promise<General.CallbackResult>
|
|
94
62
|
|
|
95
63
|
namespace getImageInfo {
|
|
96
64
|
interface Option {
|
|
97
65
|
/** 图片的路径,可以是相对路径、临时文件路径、存储文件路径、网络图片路径 */
|
|
98
66
|
src: string
|
|
99
67
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
100
|
-
complete?: (res:
|
|
68
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
101
69
|
/** 接口调用失败的回调函数 */
|
|
102
|
-
fail?: (res:
|
|
70
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
103
71
|
/** 接口调用成功的回调函数 */
|
|
104
72
|
success?: (result: SuccessCallbackResult) => void
|
|
105
73
|
}
|
|
106
|
-
interface SuccessCallbackResult extends
|
|
74
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
107
75
|
/** 图片原始高度,单位px。不考虑旋转。 */
|
|
108
76
|
height: number
|
|
109
77
|
/** [拍照时设备方向](http://sylvana.net/jpegcrop/exif_orientation.html)
|
|
@@ -139,41 +107,15 @@ declare namespace Taro {
|
|
|
139
107
|
'left'
|
|
140
108
|
}
|
|
141
109
|
}
|
|
142
|
-
/** 获取图片信息。网络图片需先配置download域名才能生效。
|
|
143
|
-
* @supported weapp, h5, rn, alipay, swan
|
|
144
|
-
* @example
|
|
145
|
-
* ```tsx
|
|
146
|
-
* Taro.getImageInfo({
|
|
147
|
-
* src: 'images/a.jpg',
|
|
148
|
-
* success: function (res) {
|
|
149
|
-
* console.log(res.width)
|
|
150
|
-
* console.log(res.height)
|
|
151
|
-
* }
|
|
152
|
-
* })
|
|
153
|
-
* Taro.chooseImage({
|
|
154
|
-
* success: function (res) {
|
|
155
|
-
* Taro.getImageInfo({
|
|
156
|
-
* src: res.tempFilePaths[0],
|
|
157
|
-
* success: function (res) {
|
|
158
|
-
* console.log(res.width)
|
|
159
|
-
* console.log(res.height)
|
|
160
|
-
* }
|
|
161
|
-
* })
|
|
162
|
-
* }
|
|
163
|
-
* })
|
|
164
|
-
* ```
|
|
165
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.getImageInfo.html
|
|
166
|
-
*/
|
|
167
|
-
function getImageInfo(option: getImageInfo.Option): Promise<getImageInfo.SuccessCallbackResult>
|
|
168
110
|
|
|
169
111
|
namespace chooseImage {
|
|
170
112
|
interface Option {
|
|
171
113
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
172
|
-
complete?: (res:
|
|
114
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
173
115
|
/** 最多可以选择的图片张数 */
|
|
174
116
|
count?: number
|
|
175
117
|
/** 接口调用失败的回调函数 */
|
|
176
|
-
fail?: (res:
|
|
118
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
177
119
|
/** 所选的图片的尺寸 */
|
|
178
120
|
sizeType?: Array<keyof sizeType>
|
|
179
121
|
/** 选择图片的来源 */
|
|
@@ -199,7 +141,7 @@ declare namespace Taro {
|
|
|
199
141
|
/** 使用后置摄像头(仅H5纯浏览器) */
|
|
200
142
|
environment
|
|
201
143
|
}
|
|
202
|
-
interface SuccessCallbackResult extends
|
|
144
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
203
145
|
/** 图片的本地临时文件路径列表 */
|
|
204
146
|
tempFilePaths: string[]
|
|
205
147
|
/** 图片的本地临时文件列表 */
|
|
@@ -223,39 +165,21 @@ declare namespace Taro {
|
|
|
223
165
|
originalFileObj?: File
|
|
224
166
|
}
|
|
225
167
|
}
|
|
226
|
-
/**
|
|
227
|
-
* 从本地相册选择图片或使用相机拍照。
|
|
228
|
-
* @supported weapp, h5, rn, alipay, swan
|
|
229
|
-
* @example
|
|
230
|
-
* ```tsx
|
|
231
|
-
* Taro.chooseImage({
|
|
232
|
-
* count: 1, // 默认9
|
|
233
|
-
* sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
234
|
-
* sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有,在H5浏览器端支持使用 `user` 和 `environment`分别指定为前后摄像头
|
|
235
|
-
* success: function (res) {
|
|
236
|
-
* // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
|
|
237
|
-
* var tempFilePaths = res.tempFilePaths
|
|
238
|
-
* }
|
|
239
|
-
* })
|
|
240
|
-
* ```
|
|
241
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html
|
|
242
|
-
*/
|
|
243
|
-
function chooseImage(option: chooseImage.Option): Promise<chooseImage.SuccessCallbackResult>
|
|
244
168
|
|
|
245
169
|
namespace compressImage {
|
|
246
170
|
interface Option {
|
|
247
171
|
/** 图片路径,图片的路径,可以是相对路径、临时文件路径、存储文件路径 */
|
|
248
172
|
src: string
|
|
249
173
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
250
|
-
complete?: (res:
|
|
174
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
251
175
|
/** 接口调用失败的回调函数 */
|
|
252
|
-
fail?: (res:
|
|
176
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
253
177
|
/** 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)。 */
|
|
254
178
|
quality?: number
|
|
255
179
|
/** 接口调用成功的回调函数 */
|
|
256
180
|
success?: (result: SuccessCallbackResult) => void
|
|
257
181
|
}
|
|
258
|
-
interface SuccessCallbackResult extends
|
|
182
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
259
183
|
/** 压缩后图片的临时文件路径 */
|
|
260
184
|
tempFilePath: string
|
|
261
185
|
/** 调用结果 */
|
|
@@ -263,35 +187,22 @@ declare namespace Taro {
|
|
|
263
187
|
}
|
|
264
188
|
}
|
|
265
189
|
|
|
266
|
-
/** 压缩图片接口,可选压缩质量
|
|
267
|
-
* @supported weapp
|
|
268
|
-
* @example
|
|
269
|
-
* ```tsx
|
|
270
|
-
* Taro.compressImage({
|
|
271
|
-
* src: '', // 图片路径
|
|
272
|
-
* quality: 80 // 压缩质量
|
|
273
|
-
* })
|
|
274
|
-
* ```
|
|
275
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.compressImage.html
|
|
276
|
-
*/
|
|
277
|
-
function compressImage(option: compressImage.Option): Promise<compressImage.SuccessCallbackResult>
|
|
278
|
-
|
|
279
190
|
namespace chooseMessageFile {
|
|
280
191
|
interface Option {
|
|
281
192
|
/** 最多可以选择的文件个数,可以 0~100 */
|
|
282
193
|
count: number
|
|
283
194
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
284
|
-
complete?: (res:
|
|
195
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
285
196
|
/** 根据文件拓展名过滤,仅 type==file 时有效。每一项都不能是空字符串。默认不过滤。 */
|
|
286
197
|
extension?: string[]
|
|
287
198
|
/** 接口调用失败的回调函数 */
|
|
288
|
-
fail?: (res:
|
|
199
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
289
200
|
/** 接口调用成功的回调函数 */
|
|
290
201
|
success?: (result: SuccessCallbackResult) => void
|
|
291
202
|
/** 所选的文件的类型 */
|
|
292
203
|
type?: keyof selectType
|
|
293
204
|
}
|
|
294
|
-
interface SuccessCallbackResult extends
|
|
205
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
295
206
|
/** 返回选择的文件的本地临时文件对象数组 */
|
|
296
207
|
tempFiles: ChooseFile[]
|
|
297
208
|
/** 调用结果 */
|
|
@@ -329,22 +240,6 @@ declare namespace Taro {
|
|
|
329
240
|
file
|
|
330
241
|
}
|
|
331
242
|
}
|
|
332
|
-
/** 从客户端会话选择文件。
|
|
333
|
-
* @supported weapp
|
|
334
|
-
* @example
|
|
335
|
-
* ```tsx
|
|
336
|
-
* Taro.chooseMessageFile({
|
|
337
|
-
* count: 10,
|
|
338
|
-
* type: 'image',
|
|
339
|
-
* success: function (res) {
|
|
340
|
-
* // tempFilePath可以作为img标签的src属性显示图片
|
|
341
|
-
* const tempFilePaths = res.tempFilePaths
|
|
342
|
-
* }
|
|
343
|
-
* })
|
|
344
|
-
* ```
|
|
345
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseMessageFile.html
|
|
346
|
-
*/
|
|
347
|
-
function chooseMessageFile(option: chooseMessageFile.Option): Promise<chooseMessageFile.SuccessCallbackResult>
|
|
348
243
|
|
|
349
244
|
namespace chooseMedia {
|
|
350
245
|
interface Option {
|
|
@@ -361,11 +256,11 @@ declare namespace Taro {
|
|
|
361
256
|
/** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头 */
|
|
362
257
|
camera?: string
|
|
363
258
|
/** 接口调用失败的回调函数 */
|
|
364
|
-
fail?: (res:
|
|
259
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
365
260
|
/** 接口调用成功的回调函数 */
|
|
366
261
|
success?: (result: SuccessCallbackResult) => void
|
|
367
262
|
}
|
|
368
|
-
interface SuccessCallbackResult extends
|
|
263
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
369
264
|
/** 本地临时文件列表 */
|
|
370
265
|
tempFiles: ChooseMedia[]
|
|
371
266
|
/** 文件类型,有效值有 image 、video */
|
|
@@ -405,23 +300,139 @@ declare namespace Taro {
|
|
|
405
300
|
front
|
|
406
301
|
}
|
|
407
302
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
303
|
+
|
|
304
|
+
interface TaroStatic {
|
|
305
|
+
/** 保存图片到系统相册。需要[用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.writePhotosAlbum
|
|
306
|
+
* @supported weapp, rn, alipay, swan
|
|
307
|
+
* @example
|
|
308
|
+
* ```tsx
|
|
309
|
+
* Taro.saveImageToPhotosAlbum({
|
|
310
|
+
* success: function (res) { }
|
|
311
|
+
* })
|
|
312
|
+
* ```
|
|
313
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html
|
|
314
|
+
*/
|
|
315
|
+
saveImageToPhotosAlbum(option: saveImageToPhotosAlbum.Option): Promise<TaroGeneral.CallbackResult>
|
|
316
|
+
|
|
317
|
+
/** 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
|
|
318
|
+
* @supported weapp, h5, rn, alipay, swan
|
|
319
|
+
* @example
|
|
320
|
+
* ```tsx
|
|
321
|
+
* Taro.previewImage({
|
|
322
|
+
* current: '', // 当前显示图片的http链接
|
|
323
|
+
* urls: [] // 需要预览的图片http链接列表
|
|
324
|
+
* })
|
|
325
|
+
* ```
|
|
326
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewImage.html
|
|
327
|
+
*/
|
|
328
|
+
previewImage(option: previewImage.Option): Promise<TaroGeneral.CallbackResult>
|
|
329
|
+
|
|
330
|
+
/** 预览图片和视频。
|
|
331
|
+
* @supported weapp 基础库 2.12.0 开始支持,低版本需做兼容处理。
|
|
332
|
+
* @example
|
|
333
|
+
* ```tsx
|
|
334
|
+
* Taro.previewMedia({
|
|
335
|
+
* sources: []
|
|
336
|
+
* })
|
|
337
|
+
* ```
|
|
338
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewMedia.html
|
|
339
|
+
*/
|
|
340
|
+
previewMedia(option: previewMedia.Option): Promise<TaroGeneral.CallbackResult>
|
|
341
|
+
|
|
342
|
+
/** 获取图片信息。网络图片需先配置download域名才能生效。
|
|
343
|
+
* @supported weapp, h5, rn, alipay, swan
|
|
344
|
+
* @example
|
|
345
|
+
* ```tsx
|
|
346
|
+
* Taro.getImageInfo({
|
|
347
|
+
* src: 'images/a.jpg',
|
|
348
|
+
* success: function (res) {
|
|
349
|
+
* console.log(res.width)
|
|
350
|
+
* console.log(res.height)
|
|
351
|
+
* }
|
|
352
|
+
* })
|
|
353
|
+
* Taro.chooseImage({
|
|
354
|
+
* success: function (res) {
|
|
355
|
+
* Taro.getImageInfo({
|
|
356
|
+
* src: res.tempFilePaths[0],
|
|
357
|
+
* success: function (res) {
|
|
358
|
+
* console.log(res.width)
|
|
359
|
+
* console.log(res.height)
|
|
360
|
+
* }
|
|
361
|
+
* })
|
|
362
|
+
* }
|
|
363
|
+
* })
|
|
364
|
+
* ```
|
|
365
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.getImageInfo.html
|
|
366
|
+
*/
|
|
367
|
+
getImageInfo(option: getImageInfo.Option): Promise<getImageInfo.SuccessCallbackResult>
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* 从本地相册选择图片或使用相机拍照。
|
|
371
|
+
* @supported weapp, h5, rn, alipay, swan
|
|
372
|
+
* @example
|
|
373
|
+
* ```tsx
|
|
374
|
+
* Taro.chooseImage({
|
|
375
|
+
* count: 1, // 默认9
|
|
376
|
+
* sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
377
|
+
* sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有,在H5浏览器端支持使用 `user` 和 `environment`分别指定为前后摄像头
|
|
378
|
+
* success: function (res) {
|
|
379
|
+
* // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
|
|
380
|
+
* var tempFilePaths = res.tempFilePaths
|
|
381
|
+
* }
|
|
382
|
+
* })
|
|
383
|
+
* ```
|
|
384
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html
|
|
385
|
+
*/
|
|
386
|
+
chooseImage(option: chooseImage.Option): Promise<chooseImage.SuccessCallbackResult>
|
|
387
|
+
|
|
388
|
+
/** 压缩图片接口,可选压缩质量
|
|
389
|
+
* @supported weapp
|
|
390
|
+
* @example
|
|
391
|
+
* ```tsx
|
|
392
|
+
* Taro.compressImage({
|
|
393
|
+
* src: '', // 图片路径
|
|
394
|
+
* quality: 80 // 压缩质量
|
|
395
|
+
* })
|
|
396
|
+
* ```
|
|
397
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.compressImage.html
|
|
398
|
+
*/
|
|
399
|
+
compressImage(option: compressImage.Option): Promise<compressImage.SuccessCallbackResult>
|
|
400
|
+
|
|
401
|
+
/** 从客户端会话选择文件。
|
|
402
|
+
* @supported weapp
|
|
403
|
+
* @example
|
|
404
|
+
* ```tsx
|
|
405
|
+
* Taro.chooseMessageFile({
|
|
406
|
+
* count: 10,
|
|
407
|
+
* type: 'image',
|
|
408
|
+
* success: function (res) {
|
|
409
|
+
* // tempFilePath可以作为img标签的src属性显示图片
|
|
410
|
+
* const tempFilePaths = res.tempFilePaths
|
|
411
|
+
* }
|
|
412
|
+
* })
|
|
413
|
+
* ```
|
|
414
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseMessageFile.html
|
|
415
|
+
*/
|
|
416
|
+
chooseMessageFile(option: chooseMessageFile.Option): Promise<chooseMessageFile.SuccessCallbackResult>
|
|
417
|
+
|
|
418
|
+
/** 拍摄或从手机相册中选择图片或视频。
|
|
419
|
+
* @supported weapp, rn
|
|
420
|
+
* @example
|
|
421
|
+
* ```tsx
|
|
422
|
+
* Taro.chooseMedia({
|
|
423
|
+
* count: 9,
|
|
424
|
+
* mediaType: ['image','video'],
|
|
425
|
+
* sourceType: ['album', 'camera'],
|
|
426
|
+
* maxDuration: 30,
|
|
427
|
+
* camera: 'back',
|
|
428
|
+
* success: (res) => {
|
|
429
|
+
* console.log(res.tempFiles)
|
|
430
|
+
* console.log(res.type)
|
|
431
|
+
* }
|
|
432
|
+
* })
|
|
433
|
+
* ```
|
|
434
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html
|
|
435
|
+
*/
|
|
436
|
+
chooseMedia(option: chooseMedia.Option): Promise<chooseMedia.SuccessCallbackResult>
|
|
437
|
+
}
|
|
427
438
|
}
|