@tarojs/taro 3.3.13 → 3.3.17
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 +116 -111
- 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 +163 -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 +40 -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 +66 -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 +159 -150
- 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/compile.d.ts +1 -5
- package/types/global.d.ts +392 -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 +28 -6
- package/types/taro.extend.d.ts +50 -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,47 +107,23 @@ 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
|
/** 选择图片的来源 */
|
|
180
122
|
sourceType?: Array<keyof sourceType>
|
|
181
123
|
/** 接口调用成功的回调函数 */
|
|
182
124
|
success?: (result: SuccessCallbackResult) => void
|
|
125
|
+
/** 用来上传的input元素ID(仅h5端)@supported h5 */
|
|
126
|
+
imageId?: string
|
|
183
127
|
}
|
|
184
128
|
/** 图片的尺寸 */
|
|
185
129
|
interface sizeType {
|
|
@@ -199,7 +143,7 @@ declare namespace Taro {
|
|
|
199
143
|
/** 使用后置摄像头(仅H5纯浏览器) */
|
|
200
144
|
environment
|
|
201
145
|
}
|
|
202
|
-
interface SuccessCallbackResult extends
|
|
146
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
203
147
|
/** 图片的本地临时文件路径列表 */
|
|
204
148
|
tempFilePaths: string[]
|
|
205
149
|
/** 图片的本地临时文件列表 */
|
|
@@ -223,39 +167,21 @@ declare namespace Taro {
|
|
|
223
167
|
originalFileObj?: File
|
|
224
168
|
}
|
|
225
169
|
}
|
|
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
170
|
|
|
245
171
|
namespace compressImage {
|
|
246
172
|
interface Option {
|
|
247
173
|
/** 图片路径,图片的路径,可以是相对路径、临时文件路径、存储文件路径 */
|
|
248
174
|
src: string
|
|
249
175
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
250
|
-
complete?: (res:
|
|
176
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
251
177
|
/** 接口调用失败的回调函数 */
|
|
252
|
-
fail?: (res:
|
|
178
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
253
179
|
/** 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)。 */
|
|
254
180
|
quality?: number
|
|
255
181
|
/** 接口调用成功的回调函数 */
|
|
256
182
|
success?: (result: SuccessCallbackResult) => void
|
|
257
183
|
}
|
|
258
|
-
interface SuccessCallbackResult extends
|
|
184
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
259
185
|
/** 压缩后图片的临时文件路径 */
|
|
260
186
|
tempFilePath: string
|
|
261
187
|
/** 调用结果 */
|
|
@@ -263,35 +189,22 @@ declare namespace Taro {
|
|
|
263
189
|
}
|
|
264
190
|
}
|
|
265
191
|
|
|
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
192
|
namespace chooseMessageFile {
|
|
280
193
|
interface Option {
|
|
281
194
|
/** 最多可以选择的文件个数,可以 0~100 */
|
|
282
195
|
count: number
|
|
283
196
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
284
|
-
complete?: (res:
|
|
197
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
285
198
|
/** 根据文件拓展名过滤,仅 type==file 时有效。每一项都不能是空字符串。默认不过滤。 */
|
|
286
199
|
extension?: string[]
|
|
287
200
|
/** 接口调用失败的回调函数 */
|
|
288
|
-
fail?: (res:
|
|
201
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
289
202
|
/** 接口调用成功的回调函数 */
|
|
290
203
|
success?: (result: SuccessCallbackResult) => void
|
|
291
204
|
/** 所选的文件的类型 */
|
|
292
205
|
type?: keyof selectType
|
|
293
206
|
}
|
|
294
|
-
interface SuccessCallbackResult extends
|
|
207
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
295
208
|
/** 返回选择的文件的本地临时文件对象数组 */
|
|
296
209
|
tempFiles: ChooseFile[]
|
|
297
210
|
/** 调用结果 */
|
|
@@ -329,22 +242,6 @@ declare namespace Taro {
|
|
|
329
242
|
file
|
|
330
243
|
}
|
|
331
244
|
}
|
|
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
245
|
|
|
349
246
|
namespace chooseMedia {
|
|
350
247
|
interface Option {
|
|
@@ -361,11 +258,11 @@ declare namespace Taro {
|
|
|
361
258
|
/** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头 */
|
|
362
259
|
camera?: string
|
|
363
260
|
/** 接口调用失败的回调函数 */
|
|
364
|
-
fail?: (res:
|
|
261
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
365
262
|
/** 接口调用成功的回调函数 */
|
|
366
263
|
success?: (result: SuccessCallbackResult) => void
|
|
367
264
|
}
|
|
368
|
-
interface SuccessCallbackResult extends
|
|
265
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
369
266
|
/** 本地临时文件列表 */
|
|
370
267
|
tempFiles: ChooseMedia[]
|
|
371
268
|
/** 文件类型,有效值有 image 、video */
|
|
@@ -405,23 +302,139 @@ declare namespace Taro {
|
|
|
405
302
|
front
|
|
406
303
|
}
|
|
407
304
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
305
|
+
|
|
306
|
+
interface TaroStatic {
|
|
307
|
+
/** 保存图片到系统相册。需要[用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.writePhotosAlbum
|
|
308
|
+
* @supported weapp, rn, alipay, swan
|
|
309
|
+
* @example
|
|
310
|
+
* ```tsx
|
|
311
|
+
* Taro.saveImageToPhotosAlbum({
|
|
312
|
+
* success: function (res) { }
|
|
313
|
+
* })
|
|
314
|
+
* ```
|
|
315
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html
|
|
316
|
+
*/
|
|
317
|
+
saveImageToPhotosAlbum(option: saveImageToPhotosAlbum.Option): Promise<TaroGeneral.CallbackResult>
|
|
318
|
+
|
|
319
|
+
/** 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
|
|
320
|
+
* @supported weapp, h5, rn, alipay, swan
|
|
321
|
+
* @example
|
|
322
|
+
* ```tsx
|
|
323
|
+
* Taro.previewImage({
|
|
324
|
+
* current: '', // 当前显示图片的http链接
|
|
325
|
+
* urls: [] // 需要预览的图片http链接列表
|
|
326
|
+
* })
|
|
327
|
+
* ```
|
|
328
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewImage.html
|
|
329
|
+
*/
|
|
330
|
+
previewImage(option: previewImage.Option): Promise<TaroGeneral.CallbackResult>
|
|
331
|
+
|
|
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
|
+
/** 获取图片信息。网络图片需先配置download域名才能生效。
|
|
345
|
+
* @supported weapp, h5, rn, alipay, swan
|
|
346
|
+
* @example
|
|
347
|
+
* ```tsx
|
|
348
|
+
* Taro.getImageInfo({
|
|
349
|
+
* src: 'images/a.jpg',
|
|
350
|
+
* success: function (res) {
|
|
351
|
+
* console.log(res.width)
|
|
352
|
+
* console.log(res.height)
|
|
353
|
+
* }
|
|
354
|
+
* })
|
|
355
|
+
* Taro.chooseImage({
|
|
356
|
+
* success: function (res) {
|
|
357
|
+
* Taro.getImageInfo({
|
|
358
|
+
* src: res.tempFilePaths[0],
|
|
359
|
+
* success: function (res) {
|
|
360
|
+
* console.log(res.width)
|
|
361
|
+
* console.log(res.height)
|
|
362
|
+
* }
|
|
363
|
+
* })
|
|
364
|
+
* }
|
|
365
|
+
* })
|
|
366
|
+
* ```
|
|
367
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.getImageInfo.html
|
|
368
|
+
*/
|
|
369
|
+
getImageInfo(option: getImageInfo.Option): Promise<getImageInfo.SuccessCallbackResult>
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* 从本地相册选择图片或使用相机拍照。
|
|
373
|
+
* @supported weapp, h5, rn, alipay, swan
|
|
374
|
+
* @example
|
|
375
|
+
* ```tsx
|
|
376
|
+
* Taro.chooseImage({
|
|
377
|
+
* count: 1, // 默认9
|
|
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
|
+
* }
|
|
384
|
+
* })
|
|
385
|
+
* ```
|
|
386
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html
|
|
387
|
+
*/
|
|
388
|
+
chooseImage(option: chooseImage.Option): Promise<chooseImage.SuccessCallbackResult>
|
|
389
|
+
|
|
390
|
+
/** 压缩图片接口,可选压缩质量
|
|
391
|
+
* @supported weapp
|
|
392
|
+
* @example
|
|
393
|
+
* ```tsx
|
|
394
|
+
* Taro.compressImage({
|
|
395
|
+
* src: '', // 图片路径
|
|
396
|
+
* quality: 80 // 压缩质量
|
|
397
|
+
* })
|
|
398
|
+
* ```
|
|
399
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.compressImage.html
|
|
400
|
+
*/
|
|
401
|
+
compressImage(option: compressImage.Option): Promise<compressImage.SuccessCallbackResult>
|
|
402
|
+
|
|
403
|
+
/** 从客户端会话选择文件。
|
|
404
|
+
* @supported weapp
|
|
405
|
+
* @example
|
|
406
|
+
* ```tsx
|
|
407
|
+
* Taro.chooseMessageFile({
|
|
408
|
+
* count: 10,
|
|
409
|
+
* type: 'image',
|
|
410
|
+
* success: function (res) {
|
|
411
|
+
* // tempFilePath可以作为img标签的src属性显示图片
|
|
412
|
+
* const tempFilePaths = res.tempFilePaths
|
|
413
|
+
* }
|
|
414
|
+
* })
|
|
415
|
+
* ```
|
|
416
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseMessageFile.html
|
|
417
|
+
*/
|
|
418
|
+
chooseMessageFile(option: chooseMessageFile.Option): Promise<chooseMessageFile.SuccessCallbackResult>
|
|
419
|
+
|
|
420
|
+
/** 拍摄或从手机相册中选择图片或视频。
|
|
421
|
+
* @supported weapp, rn
|
|
422
|
+
* @example
|
|
423
|
+
* ```tsx
|
|
424
|
+
* Taro.chooseMedia({
|
|
425
|
+
* count: 9,
|
|
426
|
+
* mediaType: ['image','video'],
|
|
427
|
+
* sourceType: ['album', 'camera'],
|
|
428
|
+
* maxDuration: 30,
|
|
429
|
+
* camera: 'back',
|
|
430
|
+
* success: (res) => {
|
|
431
|
+
* console.log(res.tempFiles)
|
|
432
|
+
* console.log(res.type)
|
|
433
|
+
* }
|
|
434
|
+
* })
|
|
435
|
+
* ```
|
|
436
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html
|
|
437
|
+
*/
|
|
438
|
+
chooseMedia(option: chooseMedia.Option): Promise<chooseMedia.SuccessCallbackResult>
|
|
439
|
+
}
|
|
427
440
|
}
|