@tarojs/taro 3.3.10 → 3.3.14
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/html5.css +5 -5
- 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 +72 -0
- 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 +48 -42
- package/types/api/device/nfc.d.ts +105 -96
- package/types/api/device/performance.d.ts +22 -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 +139 -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 +190 -137
- 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 +45 -0
- 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 +54 -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 +350 -0
- package/types/index.d.ts +14 -99
- 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 +70 -67
- 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
- package/types/api/open-api/data-analysis.d.ts +0 -19
- package/types/api/open-api/report.d.ts +0 -19
|
@@ -1,67 +1,77 @@
|
|
|
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 {
|
|
28
19
|
/** 需要预览的图片链接列表。 */
|
|
29
20
|
urls: string[]
|
|
30
|
-
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
31
|
-
complete?: (res: General.CallbackResult) => void
|
|
32
21
|
/** 当前显示图片的链接 */
|
|
33
22
|
current?: string
|
|
23
|
+
/** @support weapp 最低版本:2.13.0。是否显示长按菜单,默认值:true */
|
|
24
|
+
showmenu?: boolean
|
|
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 */
|
|
26
|
+
referrerPolicy?: string
|
|
27
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
28
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
29
|
+
/** 接口调用失败的回调函数 */
|
|
30
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
31
|
+
/** 接口调用成功的回调函数 */
|
|
32
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
namespace previewMedia {
|
|
37
|
+
interface Sources {
|
|
38
|
+
/** 图片或视频的地址 */
|
|
39
|
+
url: string
|
|
40
|
+
/** 资源的类型(图片或视频),默认值:image */
|
|
41
|
+
type?: 'image' | 'video'
|
|
42
|
+
/** 视频的封面图片 */
|
|
43
|
+
poster?: string
|
|
44
|
+
}
|
|
45
|
+
interface Option {
|
|
46
|
+
/** 需要预览的资源列表 */
|
|
47
|
+
sources: Sources[]
|
|
48
|
+
/** 当前显示的资源序号,默认值:0 */
|
|
49
|
+
current?: number
|
|
50
|
+
/** 是否显示长按菜单 2.13.0,默认值:true */
|
|
51
|
+
showmenu?: boolean
|
|
52
|
+
/** origin: 发送完整的referrer; no-referrer: 不发送。格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本;默认值:no-referrer */
|
|
53
|
+
referrerPolicy?: string
|
|
54
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
55
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
34
56
|
/** 接口调用失败的回调函数 */
|
|
35
|
-
fail?: (res:
|
|
57
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
36
58
|
/** 接口调用成功的回调函数 */
|
|
37
|
-
success?: (res:
|
|
59
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
38
60
|
}
|
|
39
61
|
}
|
|
40
|
-
/** 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
|
|
41
|
-
* @supported weapp, h5, rn, alipay, swan
|
|
42
|
-
* @example
|
|
43
|
-
* ```tsx
|
|
44
|
-
* Taro.previewImage({
|
|
45
|
-
* current: '', // 当前显示图片的http链接
|
|
46
|
-
* urls: [] // 需要预览的图片http链接列表
|
|
47
|
-
* })
|
|
48
|
-
* ```
|
|
49
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewImage.html
|
|
50
|
-
*/
|
|
51
|
-
function previewImage(option: previewImage.Option): Promise<General.CallbackResult>
|
|
52
62
|
|
|
53
63
|
namespace getImageInfo {
|
|
54
64
|
interface Option {
|
|
55
65
|
/** 图片的路径,可以是相对路径、临时文件路径、存储文件路径、网络图片路径 */
|
|
56
66
|
src: string
|
|
57
67
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
58
|
-
complete?: (res:
|
|
68
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
59
69
|
/** 接口调用失败的回调函数 */
|
|
60
|
-
fail?: (res:
|
|
70
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
61
71
|
/** 接口调用成功的回调函数 */
|
|
62
72
|
success?: (result: SuccessCallbackResult) => void
|
|
63
73
|
}
|
|
64
|
-
interface SuccessCallbackResult extends
|
|
74
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
65
75
|
/** 图片原始高度,单位px。不考虑旋转。 */
|
|
66
76
|
height: number
|
|
67
77
|
/** [拍照时设备方向](http://sylvana.net/jpegcrop/exif_orientation.html)
|
|
@@ -97,41 +107,15 @@ declare namespace Taro {
|
|
|
97
107
|
'left'
|
|
98
108
|
}
|
|
99
109
|
}
|
|
100
|
-
/** 获取图片信息。网络图片需先配置download域名才能生效。
|
|
101
|
-
* @supported weapp, h5, rn, alipay, swan
|
|
102
|
-
* @example
|
|
103
|
-
* ```tsx
|
|
104
|
-
* Taro.getImageInfo({
|
|
105
|
-
* src: 'images/a.jpg',
|
|
106
|
-
* success: function (res) {
|
|
107
|
-
* console.log(res.width)
|
|
108
|
-
* console.log(res.height)
|
|
109
|
-
* }
|
|
110
|
-
* })
|
|
111
|
-
* Taro.chooseImage({
|
|
112
|
-
* success: function (res) {
|
|
113
|
-
* Taro.getImageInfo({
|
|
114
|
-
* src: res.tempFilePaths[0],
|
|
115
|
-
* success: function (res) {
|
|
116
|
-
* console.log(res.width)
|
|
117
|
-
* console.log(res.height)
|
|
118
|
-
* }
|
|
119
|
-
* })
|
|
120
|
-
* }
|
|
121
|
-
* })
|
|
122
|
-
* ```
|
|
123
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.getImageInfo.html
|
|
124
|
-
*/
|
|
125
|
-
function getImageInfo(option: getImageInfo.Option): Promise<getImageInfo.SuccessCallbackResult>
|
|
126
110
|
|
|
127
111
|
namespace chooseImage {
|
|
128
112
|
interface Option {
|
|
129
113
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
130
|
-
complete?: (res:
|
|
114
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
131
115
|
/** 最多可以选择的图片张数 */
|
|
132
116
|
count?: number
|
|
133
117
|
/** 接口调用失败的回调函数 */
|
|
134
|
-
fail?: (res:
|
|
118
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
135
119
|
/** 所选的图片的尺寸 */
|
|
136
120
|
sizeType?: Array<keyof sizeType>
|
|
137
121
|
/** 选择图片的来源 */
|
|
@@ -157,7 +141,7 @@ declare namespace Taro {
|
|
|
157
141
|
/** 使用后置摄像头(仅H5纯浏览器) */
|
|
158
142
|
environment
|
|
159
143
|
}
|
|
160
|
-
interface SuccessCallbackResult extends
|
|
144
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
161
145
|
/** 图片的本地临时文件路径列表 */
|
|
162
146
|
tempFilePaths: string[]
|
|
163
147
|
/** 图片的本地临时文件列表 */
|
|
@@ -181,39 +165,21 @@ declare namespace Taro {
|
|
|
181
165
|
originalFileObj?: File
|
|
182
166
|
}
|
|
183
167
|
}
|
|
184
|
-
/**
|
|
185
|
-
* 从本地相册选择图片或使用相机拍照。
|
|
186
|
-
* @supported weapp, h5, rn, alipay, swan
|
|
187
|
-
* @example
|
|
188
|
-
* ```tsx
|
|
189
|
-
* Taro.chooseImage({
|
|
190
|
-
* count: 1, // 默认9
|
|
191
|
-
* sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
192
|
-
* sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有,在H5浏览器端支持使用 `user` 和 `environment`分别指定为前后摄像头
|
|
193
|
-
* success: function (res) {
|
|
194
|
-
* // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
|
|
195
|
-
* var tempFilePaths = res.tempFilePaths
|
|
196
|
-
* }
|
|
197
|
-
* })
|
|
198
|
-
* ```
|
|
199
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html
|
|
200
|
-
*/
|
|
201
|
-
function chooseImage(option: chooseImage.Option): Promise<chooseImage.SuccessCallbackResult>
|
|
202
168
|
|
|
203
169
|
namespace compressImage {
|
|
204
170
|
interface Option {
|
|
205
171
|
/** 图片路径,图片的路径,可以是相对路径、临时文件路径、存储文件路径 */
|
|
206
172
|
src: string
|
|
207
173
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
208
|
-
complete?: (res:
|
|
174
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
209
175
|
/** 接口调用失败的回调函数 */
|
|
210
|
-
fail?: (res:
|
|
176
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
211
177
|
/** 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)。 */
|
|
212
178
|
quality?: number
|
|
213
179
|
/** 接口调用成功的回调函数 */
|
|
214
180
|
success?: (result: SuccessCallbackResult) => void
|
|
215
181
|
}
|
|
216
|
-
interface SuccessCallbackResult extends
|
|
182
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
217
183
|
/** 压缩后图片的临时文件路径 */
|
|
218
184
|
tempFilePath: string
|
|
219
185
|
/** 调用结果 */
|
|
@@ -221,35 +187,22 @@ declare namespace Taro {
|
|
|
221
187
|
}
|
|
222
188
|
}
|
|
223
189
|
|
|
224
|
-
/** 压缩图片接口,可选压缩质量
|
|
225
|
-
* @supported weapp
|
|
226
|
-
* @example
|
|
227
|
-
* ```tsx
|
|
228
|
-
* Taro.compressImage({
|
|
229
|
-
* src: '', // 图片路径
|
|
230
|
-
* quality: 80 // 压缩质量
|
|
231
|
-
* })
|
|
232
|
-
* ```
|
|
233
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.compressImage.html
|
|
234
|
-
*/
|
|
235
|
-
function compressImage(option: compressImage.Option): Promise<compressImage.SuccessCallbackResult>
|
|
236
|
-
|
|
237
190
|
namespace chooseMessageFile {
|
|
238
191
|
interface Option {
|
|
239
192
|
/** 最多可以选择的文件个数,可以 0~100 */
|
|
240
193
|
count: number
|
|
241
194
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
242
|
-
complete?: (res:
|
|
195
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
243
196
|
/** 根据文件拓展名过滤,仅 type==file 时有效。每一项都不能是空字符串。默认不过滤。 */
|
|
244
197
|
extension?: string[]
|
|
245
198
|
/** 接口调用失败的回调函数 */
|
|
246
|
-
fail?: (res:
|
|
199
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
247
200
|
/** 接口调用成功的回调函数 */
|
|
248
201
|
success?: (result: SuccessCallbackResult) => void
|
|
249
202
|
/** 所选的文件的类型 */
|
|
250
203
|
type?: keyof selectType
|
|
251
204
|
}
|
|
252
|
-
interface SuccessCallbackResult extends
|
|
205
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
253
206
|
/** 返回选择的文件的本地临时文件对象数组 */
|
|
254
207
|
tempFiles: ChooseFile[]
|
|
255
208
|
/** 调用结果 */
|
|
@@ -287,22 +240,6 @@ declare namespace Taro {
|
|
|
287
240
|
file
|
|
288
241
|
}
|
|
289
242
|
}
|
|
290
|
-
/** 从客户端会话选择文件。
|
|
291
|
-
* @supported weapp
|
|
292
|
-
* @example
|
|
293
|
-
* ```tsx
|
|
294
|
-
* Taro.chooseMessageFile({
|
|
295
|
-
* count: 10,
|
|
296
|
-
* type: 'image',
|
|
297
|
-
* success: function (res) {
|
|
298
|
-
* // tempFilePath可以作为img标签的src属性显示图片
|
|
299
|
-
* const tempFilePaths = res.tempFilePaths
|
|
300
|
-
* }
|
|
301
|
-
* })
|
|
302
|
-
* ```
|
|
303
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseMessageFile.html
|
|
304
|
-
*/
|
|
305
|
-
function chooseMessageFile(option: chooseMessageFile.Option): Promise<chooseMessageFile.SuccessCallbackResult>
|
|
306
243
|
|
|
307
244
|
namespace chooseMedia {
|
|
308
245
|
interface Option {
|
|
@@ -319,11 +256,11 @@ declare namespace Taro {
|
|
|
319
256
|
/** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头 */
|
|
320
257
|
camera?: string
|
|
321
258
|
/** 接口调用失败的回调函数 */
|
|
322
|
-
fail?: (res:
|
|
259
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
323
260
|
/** 接口调用成功的回调函数 */
|
|
324
261
|
success?: (result: SuccessCallbackResult) => void
|
|
325
262
|
}
|
|
326
|
-
interface SuccessCallbackResult extends
|
|
263
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
327
264
|
/** 本地临时文件列表 */
|
|
328
265
|
tempFiles: ChooseMedia[]
|
|
329
266
|
/** 文件类型,有效值有 image 、video */
|
|
@@ -363,23 +300,139 @@ declare namespace Taro {
|
|
|
363
300
|
front
|
|
364
301
|
}
|
|
365
302
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
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
|
+
}
|
|
385
438
|
}
|