@tarojs/taro 3.4.1 → 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 -5
- 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 +46 -23
- package/types/api/base/weapp/life-cycle.d.ts +141 -1
- package/types/api/canvas/index.d.ts +150 -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 +629 -38
- package/types/api/media/background-audio.d.ts +8 -8
- 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 +61 -32
- 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 +45 -16
- package/types/api/media/voip.d.ts +290 -0
- package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +63 -25
- package/types/api/network/download.d.ts +39 -16
- package/types/api/network/request.d.ts +125 -37
- 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/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 +111 -107
- package/types/compile.d.ts +5 -0
- package/types/global.d.ts +142 -111
- package/types/taro.api.d.ts +79 -62
- package/types/api/open-api/payment.d.ts +0 -61
|
@@ -3,12 +3,15 @@ import Taro from '../../index'
|
|
|
3
3
|
declare module '../../index' {
|
|
4
4
|
namespace createAnimation {
|
|
5
5
|
interface Option {
|
|
6
|
-
/** 动画延迟时间,单位 ms */
|
|
7
|
-
delay?: number
|
|
8
6
|
/** 动画持续时间,单位 ms */
|
|
9
7
|
duration?: number
|
|
10
8
|
/** 动画的效果 */
|
|
11
|
-
timingFunction?: keyof
|
|
9
|
+
timingFunction?: keyof TimingFunction
|
|
10
|
+
/** 动画延迟时间,单位 ms
|
|
11
|
+
* @default 0
|
|
12
|
+
*/
|
|
13
|
+
delay?: number
|
|
14
|
+
/** @default "50% 50% 0" */
|
|
12
15
|
transformOrigin?: string
|
|
13
16
|
/**
|
|
14
17
|
* 单位
|
|
@@ -16,7 +19,7 @@ declare module '../../index' {
|
|
|
16
19
|
*/
|
|
17
20
|
unit?: string
|
|
18
21
|
}
|
|
19
|
-
interface
|
|
22
|
+
interface TimingFunction {
|
|
20
23
|
/** 动画从头到尾的速度是相同的 */
|
|
21
24
|
linear
|
|
22
25
|
/** 动画以低速开始,然后加快,在结束前变慢 */
|
|
@@ -34,72 +37,33 @@ declare module '../../index' {
|
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
39
|
|
|
40
|
+
/** 动画对象
|
|
41
|
+
* @supported weapp, h5
|
|
42
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html
|
|
43
|
+
*/
|
|
37
44
|
interface Animation {
|
|
38
|
-
/** 导出动画队列。**export
|
|
45
|
+
/** 导出动画队列。**export 方法每次调用后会清掉之前的动画操作**。
|
|
39
46
|
* @supported weapp, h5
|
|
40
47
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.export.html
|
|
41
48
|
*/
|
|
42
49
|
export(): {
|
|
43
50
|
actions: TaroGeneral.IAnyObject[]
|
|
44
51
|
}
|
|
45
|
-
/**
|
|
46
|
-
* @supported weapp, h5
|
|
47
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.backgroundColor.html
|
|
48
|
-
*/
|
|
49
|
-
backgroundColor(
|
|
50
|
-
/** 颜色值 */
|
|
51
|
-
value: string,
|
|
52
|
-
): Animation
|
|
53
|
-
/** 设置 bottom 值
|
|
54
|
-
* @supported weapp, h5
|
|
55
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.bottom.html
|
|
56
|
-
*/
|
|
57
|
-
bottom(
|
|
58
|
-
/** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
|
|
59
|
-
value: number | string,
|
|
60
|
-
): Animation
|
|
61
|
-
/** 设置高度
|
|
62
|
-
* @supported weapp, h5
|
|
63
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.height.html
|
|
64
|
-
*/
|
|
65
|
-
height(
|
|
66
|
-
/** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
|
|
67
|
-
value: number | string,
|
|
68
|
-
): Animation
|
|
69
|
-
/** 设置 left 值
|
|
52
|
+
/** 表示一组动画完成。可以在一组动画中调用任意多个动画方法,一组动画中的所有动画会同时开始,一组动画完成后才会进行下一组动画。
|
|
70
53
|
* @supported weapp, h5
|
|
71
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.
|
|
54
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.step.html
|
|
72
55
|
*/
|
|
73
|
-
|
|
74
|
-
/** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
|
|
75
|
-
value: number | string,
|
|
76
|
-
): Animation
|
|
56
|
+
step(option?: Animation.StepOption): Animation
|
|
77
57
|
/** 同 [transform-function matrix](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix)
|
|
78
58
|
* @supported weapp, h5
|
|
79
59
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.matrix.html
|
|
80
60
|
*/
|
|
81
61
|
matrix(a: number, b: number, c: number, d: number, tx: number, ty: number): Animation
|
|
82
62
|
/** 同 [transform-function matrix3d](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix3d)
|
|
83
|
-
* @supported weapp
|
|
63
|
+
* @supported weapp, h5
|
|
84
64
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.matrix3d.html
|
|
85
65
|
*/
|
|
86
66
|
matrix3d(a1: number, b1: number, c1: number, d1: number, a2: number, b2: number, c2: number, d2: number, a3: number, b3: number, c3: number, d3: number, a4: number, b4: number, c4: number, d4: number): Animation
|
|
87
|
-
/** 设置透明度
|
|
88
|
-
* @supported weapp, h5
|
|
89
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.opacity.html
|
|
90
|
-
*/
|
|
91
|
-
opacity(
|
|
92
|
-
/** 透明度,范围 0-1 */
|
|
93
|
-
value: number,
|
|
94
|
-
): Animation
|
|
95
|
-
/** 设置 right 值
|
|
96
|
-
* @supported weapp, h5
|
|
97
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.right.html
|
|
98
|
-
*/
|
|
99
|
-
right(
|
|
100
|
-
/** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
|
|
101
|
-
value: number | string,
|
|
102
|
-
): Animation
|
|
103
67
|
/** 从原点顺时针旋转一个角度
|
|
104
68
|
* @supported weapp, h5
|
|
105
69
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotate.html
|
|
@@ -193,7 +157,7 @@ declare module '../../index' {
|
|
|
193
157
|
scale: number,
|
|
194
158
|
): Animation
|
|
195
159
|
/** 对 X、Y 轴坐标进行倾斜
|
|
196
|
-
* @supported weapp
|
|
160
|
+
* @supported weapp, h5
|
|
197
161
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skew.html
|
|
198
162
|
*/
|
|
199
163
|
skew(
|
|
@@ -211,26 +175,13 @@ declare module '../../index' {
|
|
|
211
175
|
angle: number,
|
|
212
176
|
): Animation
|
|
213
177
|
/** 对 Y 轴坐标进行倾斜
|
|
214
|
-
* @supported weapp
|
|
178
|
+
* @supported weapp, h5
|
|
215
179
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skewY.html
|
|
216
180
|
*/
|
|
217
181
|
skewY(
|
|
218
182
|
/** 倾斜的角度,范围 [-180, 180] */
|
|
219
183
|
angle: number,
|
|
220
184
|
): Animation
|
|
221
|
-
/** 表示一组动画完成。可以在一组动画中调用任意多个动画方法,一组动画中的所有动画会同时开始,一组动画完成后才会进行下一组动画。
|
|
222
|
-
* @supported weapp, h5
|
|
223
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.step.html
|
|
224
|
-
*/
|
|
225
|
-
step(option?: Animation.StepOption): Animation
|
|
226
|
-
/** 设置 top 值
|
|
227
|
-
* @supported weapp, h5
|
|
228
|
-
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.top.html
|
|
229
|
-
*/
|
|
230
|
-
top(
|
|
231
|
-
/** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
|
|
232
|
-
value: number | string,
|
|
233
|
-
): Animation
|
|
234
185
|
/** 平移变换
|
|
235
186
|
* @supported weapp, h5
|
|
236
187
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translate.html
|
|
@@ -277,6 +228,22 @@ declare module '../../index' {
|
|
|
277
228
|
/** 在 Z 轴平移的距离,单位为 px */
|
|
278
229
|
translation: number,
|
|
279
230
|
): Animation
|
|
231
|
+
/** 设置透明度
|
|
232
|
+
* @supported weapp, h5
|
|
233
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.opacity.html
|
|
234
|
+
*/
|
|
235
|
+
opacity(
|
|
236
|
+
/** 透明度,范围 0-1 */
|
|
237
|
+
value: number,
|
|
238
|
+
): Animation
|
|
239
|
+
/** 设置背景色
|
|
240
|
+
* @supported weapp, h5
|
|
241
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.backgroundColor.html
|
|
242
|
+
*/
|
|
243
|
+
backgroundColor(
|
|
244
|
+
/** 颜色值 */
|
|
245
|
+
value: string,
|
|
246
|
+
): Animation
|
|
280
247
|
/** 设置宽度
|
|
281
248
|
* @supported weapp, h5
|
|
282
249
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.width.html
|
|
@@ -285,6 +252,46 @@ declare module '../../index' {
|
|
|
285
252
|
/** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
|
|
286
253
|
value: number | string,
|
|
287
254
|
): Animation
|
|
255
|
+
/** 设置高度
|
|
256
|
+
* @supported weapp, h5
|
|
257
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.height.html
|
|
258
|
+
*/
|
|
259
|
+
height(
|
|
260
|
+
/** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
|
|
261
|
+
value: number | string,
|
|
262
|
+
): Animation
|
|
263
|
+
/** 设置 left 值
|
|
264
|
+
* @supported weapp, h5
|
|
265
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.left.html
|
|
266
|
+
*/
|
|
267
|
+
left(
|
|
268
|
+
/** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
|
|
269
|
+
value: number | string,
|
|
270
|
+
): Animation
|
|
271
|
+
/** 设置 right 值
|
|
272
|
+
* @supported weapp, h5
|
|
273
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.right.html
|
|
274
|
+
*/
|
|
275
|
+
right(
|
|
276
|
+
/** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
|
|
277
|
+
value: number | string,
|
|
278
|
+
): Animation
|
|
279
|
+
/** 设置 top 值
|
|
280
|
+
* @supported weapp, h5
|
|
281
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.top.html
|
|
282
|
+
*/
|
|
283
|
+
top(
|
|
284
|
+
/** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
|
|
285
|
+
value: number | string,
|
|
286
|
+
): Animation
|
|
287
|
+
/** 设置 bottom 值
|
|
288
|
+
* @supported weapp, h5
|
|
289
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.bottom.html
|
|
290
|
+
*/
|
|
291
|
+
bottom(
|
|
292
|
+
/** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
|
|
293
|
+
value: number | string,
|
|
294
|
+
): Animation
|
|
288
295
|
}
|
|
289
296
|
|
|
290
297
|
namespace Animation {
|
|
@@ -294,10 +301,10 @@ declare module '../../index' {
|
|
|
294
301
|
/** 动画持续时间,单位 ms */
|
|
295
302
|
duration?: number
|
|
296
303
|
/** 动画的效果 */
|
|
297
|
-
timingFunction?: keyof
|
|
304
|
+
timingFunction?: keyof TimingFunction
|
|
298
305
|
transformOrigin?: string
|
|
299
306
|
}
|
|
300
|
-
interface
|
|
307
|
+
interface TimingFunction {
|
|
301
308
|
/** 动画从头到尾的速度是相同的 */
|
|
302
309
|
linear
|
|
303
310
|
/** 动画以低速开始,然后加快,在结束前变慢 */
|
|
@@ -315,6 +322,7 @@ declare module '../../index' {
|
|
|
315
322
|
}
|
|
316
323
|
}
|
|
317
324
|
|
|
325
|
+
/** @ignore */
|
|
318
326
|
interface KeyFrame {
|
|
319
327
|
/** 关键帧的偏移,范围[0-1] */
|
|
320
328
|
offset?: number
|
|
@@ -379,6 +387,8 @@ declare module '../../index' {
|
|
|
379
387
|
/** Z 方向位移,即 CSS transform translateZ */
|
|
380
388
|
translateZ?: number | string
|
|
381
389
|
}
|
|
390
|
+
|
|
391
|
+
/** @ignore */
|
|
382
392
|
interface ClearAnimationOptions {
|
|
383
393
|
/** 基点位置,即 CSS transform-origin */
|
|
384
394
|
transformOrigin?: boolean
|
|
@@ -439,12 +449,16 @@ declare module '../../index' {
|
|
|
439
449
|
/** Z 方向位移,即 CSS transform translateZ */
|
|
440
450
|
translateZ?: boolean
|
|
441
451
|
}
|
|
452
|
+
|
|
453
|
+
/** @ignore */
|
|
442
454
|
interface ScrollTimelineKeyframe {
|
|
443
455
|
composite?: 'replace' | 'add' | 'accumulate' | 'auto'
|
|
444
456
|
easing?: string
|
|
445
457
|
offset?: number | null
|
|
446
458
|
[property: string]: string | number | null | undefined
|
|
447
459
|
}
|
|
460
|
+
|
|
461
|
+
/** @ignore */
|
|
448
462
|
interface ScrollTimelineOption {
|
|
449
463
|
/** 指定滚动元素的选择器(只支持 scroll-view),该元素滚动时会驱动动画的进度 */
|
|
450
464
|
scrollSource: string
|
|
@@ -459,7 +473,7 @@ declare module '../../index' {
|
|
|
459
473
|
}
|
|
460
474
|
|
|
461
475
|
interface TaroStatic {
|
|
462
|
-
/** 创建一个动画实例 animation。调用实例的方法来描述动画。最后通过动画实例的 export 方法导出动画数据传递给组件的 animation 属性。
|
|
476
|
+
/** 创建一个动画实例 [animation](./Animation)。调用实例的方法来描述动画。最后通过动画实例的 export 方法导出动画数据传递给组件的 animation 属性。
|
|
463
477
|
* @supported weapp, h5
|
|
464
478
|
* @example
|
|
465
479
|
* ```tsx
|
|
@@ -37,7 +37,8 @@ declare module '../../index' {
|
|
|
37
37
|
|
|
38
38
|
interface TaroStatic {
|
|
39
39
|
/** 动态设置下拉背景字体、loading 图的样式
|
|
40
|
-
* @supported weapp
|
|
40
|
+
* @supported weapp, rn
|
|
41
|
+
* @rn 仅 iOS
|
|
41
42
|
* @example
|
|
42
43
|
* ```tsx
|
|
43
44
|
* Taro.setBackgroundTextStyle({
|
|
@@ -49,7 +50,8 @@ declare module '../../index' {
|
|
|
49
50
|
setBackgroundTextStyle(option: setBackgroundTextStyle.Option): Promise<TaroGeneral.CallbackResult>
|
|
50
51
|
|
|
51
52
|
/** 动态设置窗口的背景色
|
|
52
|
-
* @supported weapp
|
|
53
|
+
* @supported weapp, rn
|
|
54
|
+
* @rn 仅 Android
|
|
53
55
|
* @example
|
|
54
56
|
* ```tsx
|
|
55
57
|
* Taro.setBackgroundColor({
|
|
@@ -7,7 +7,7 @@ declare module '../../index' {
|
|
|
7
7
|
* **说明**
|
|
8
8
|
* 因为自定义组件中的 setData 和 triggerEvent 等接口本身是同步的操作,当这几个接口被连续调用时,都是在一个同步流程中执行完的,因此若逻辑不当可能会导致出错。
|
|
9
9
|
* 一个极端的案例:当父组件的 setData 引发了子组件的 triggerEvent,进而使得父组件又进行了一次 setData,期间有通过 wx:if 语句对子组件进行卸载,就有可能引发奇怪的错误,所以对于不需要在一个同步流程内完成的逻辑,可以使用此接口延迟到下一个时间片再执行。
|
|
10
|
-
* @supported weapp
|
|
10
|
+
* @supported weapp, h5
|
|
11
11
|
* @example
|
|
12
12
|
* ```tsx
|
|
13
13
|
* this.setData({ number: 1 }) // 直接在当前同步流程中执行
|
package/types/api/ui/fonts.d.ts
CHANGED
|
@@ -11,48 +11,43 @@ declare module '../../index' {
|
|
|
11
11
|
family: string
|
|
12
12
|
/** 字体资源的地址。建议格式为 TTF 和 WOFF,WOFF2 在低版本的 iOS 上会不兼容。 */
|
|
13
13
|
source: string
|
|
14
|
-
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
15
|
-
complete?: CompleteCallback
|
|
16
14
|
/** 可选的字体描述符 */
|
|
17
15
|
desc?: DescOption
|
|
18
|
-
/** 接口调用失败的回调函数 */
|
|
19
|
-
fail?: FailCallback
|
|
20
16
|
/** 接口调用成功的回调函数 */
|
|
21
|
-
success?:
|
|
17
|
+
success?: (res: CallbackResult) => void
|
|
18
|
+
/** 接口调用失败的回调函数 */
|
|
19
|
+
fail?: (res: CallbackResult) => void
|
|
20
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
21
|
+
complete?: (res: CallbackResult) => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface CallbackResult extends TaroGeneral.CallbackResult {
|
|
25
|
+
/** 加载字体结果 */
|
|
26
|
+
status: string
|
|
22
27
|
}
|
|
23
28
|
/** 可选的字体描述符 */
|
|
24
29
|
interface DescOption {
|
|
30
|
+
/** @supported h5 */
|
|
31
|
+
ascentOverride?: string
|
|
32
|
+
/** @supported h5 */
|
|
33
|
+
descentOverride?: string
|
|
34
|
+
/** @supported h5 */
|
|
35
|
+
featureSettings?: string
|
|
36
|
+
/** @supported h5 */
|
|
37
|
+
lineGapOverride?: string
|
|
38
|
+
/** @supported h5 */
|
|
39
|
+
stretch?: string
|
|
25
40
|
/** 字体样式,可选值为 normal / italic / oblique */
|
|
26
41
|
style?: string
|
|
42
|
+
/** @supported h5 */
|
|
43
|
+
unicodeRange?: string
|
|
27
44
|
/** 设置小型大写字母的字体显示文本,可选值为 normal / small-caps / inherit */
|
|
28
45
|
variant?: string
|
|
46
|
+
/** @supported h5 */
|
|
47
|
+
variationSettings?: string
|
|
29
48
|
/** 字体粗细,可选值为 normal / bold / 100 / 200../ 900 */
|
|
30
49
|
weight?: string
|
|
31
50
|
}
|
|
32
|
-
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
33
|
-
type CompleteCallback = (
|
|
34
|
-
result: CompleteCallbackResult,
|
|
35
|
-
) => void
|
|
36
|
-
/** 接口调用失败的回调函数 */
|
|
37
|
-
type FailCallback = (
|
|
38
|
-
result: FailCallbackResult,
|
|
39
|
-
) => void
|
|
40
|
-
/** 接口调用成功的回调函数 */
|
|
41
|
-
type SuccessCallback = (
|
|
42
|
-
result: SuccessCallbackResult,
|
|
43
|
-
) => void
|
|
44
|
-
interface CompleteCallbackResult {
|
|
45
|
-
/** 加载字体结果 */
|
|
46
|
-
status: string
|
|
47
|
-
}
|
|
48
|
-
interface FailCallbackResult {
|
|
49
|
-
/** 加载字体结果 */
|
|
50
|
-
status: string
|
|
51
|
-
}
|
|
52
|
-
interface SuccessCallbackResult {
|
|
53
|
-
/** 加载字体结果 */
|
|
54
|
-
status: string
|
|
55
|
-
}
|
|
56
51
|
}
|
|
57
52
|
|
|
58
53
|
interface TaroStatic {
|
|
@@ -64,7 +59,8 @@ declare module '../../index' {
|
|
|
64
59
|
* 3. 字体链接必须是同源下的,或开启了cors支持,小程序的域名是`servicewechat.com`
|
|
65
60
|
* 4. canvas等原生组件不支持使用接口添加的字体
|
|
66
61
|
* 5. 工具里提示 Faild to load font可以忽略
|
|
67
|
-
* @supported weapp
|
|
62
|
+
* @supported weapp, h5
|
|
63
|
+
* @h5 不支持 global (默认全局加载)
|
|
68
64
|
* @example
|
|
69
65
|
* ```tsx
|
|
70
66
|
* Taro.loadFontFace({
|
|
@@ -75,6 +71,6 @@ declare module '../../index' {
|
|
|
75
71
|
* ```
|
|
76
72
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/font/wx.loadFontFace.html
|
|
77
73
|
*/
|
|
78
|
-
loadFontFace(option: loadFontFace.Option):
|
|
74
|
+
loadFontFace(option: loadFontFace.Option): Promise<loadFontFace.CallbackResult>
|
|
79
75
|
}
|
|
80
76
|
}
|
package/types/api/ui/scroll.d.ts
CHANGED
|
@@ -18,19 +18,85 @@ declare module '../../index' {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/** 增强 ScrollView 实例,可通过 [Taro.createSelectorQuery](/docs/apis/wxml/createSelectorQuery) 的 [NodesRef.node](/docs/apis/wxml/NodesRef#node) 方法获取。 仅在 `scroll-view` 组件开启 `enhanced` 属性后生效。
|
|
22
|
+
* @supported weapp
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* Taro.createSelectorQuery()
|
|
26
|
+
* .select('#scrollview')
|
|
27
|
+
* .node()
|
|
28
|
+
* .exec((res) => {
|
|
29
|
+
* const scrollView = res[0].node;
|
|
30
|
+
* scrollView.scrollEnabled = false;
|
|
31
|
+
* })
|
|
32
|
+
* ```
|
|
33
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.html
|
|
34
|
+
*/
|
|
35
|
+
interface ScrollViewContext {
|
|
36
|
+
/** 滚动开关 */
|
|
37
|
+
scrollEnabled: boolean
|
|
38
|
+
|
|
39
|
+
/** 设置滚动边界弹性 (仅在 iOS 下生效) */
|
|
40
|
+
bounces: boolean
|
|
41
|
+
|
|
42
|
+
/** 设置是否显示滚动条 */
|
|
43
|
+
showScrollbar: boolean
|
|
44
|
+
|
|
45
|
+
/** 分页滑动开关 */
|
|
46
|
+
pagingEnabled: boolean
|
|
47
|
+
|
|
48
|
+
/** 设置滚动减速速率 */
|
|
49
|
+
fastDeceleration: boolean
|
|
50
|
+
|
|
51
|
+
/** 取消滚动惯性 (仅在 iOS 下生效) */
|
|
52
|
+
decelerationDisabled: boolean
|
|
53
|
+
|
|
54
|
+
/** 滚动至指定位置
|
|
55
|
+
* @supported weapp
|
|
56
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.scrollTo.html
|
|
57
|
+
*/
|
|
58
|
+
scrollTo(object: ScrollViewContext.scrollTo.Option): void
|
|
59
|
+
|
|
60
|
+
/** 滚动至指定位置
|
|
61
|
+
* @supported weapp
|
|
62
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.scrollIntoView.html
|
|
63
|
+
*/
|
|
64
|
+
scrollIntoView(
|
|
65
|
+
/** 元素选择器 */
|
|
66
|
+
selector: string
|
|
67
|
+
): void
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
namespace ScrollViewContext {
|
|
71
|
+
namespace scrollTo {
|
|
72
|
+
interface Option {
|
|
73
|
+
/** 顶部距离 */
|
|
74
|
+
top?: number
|
|
75
|
+
/** 左边界距离 */
|
|
76
|
+
left?: number
|
|
77
|
+
/** 初始速度 */
|
|
78
|
+
velocity?: number
|
|
79
|
+
/** 滚动动画时长 */
|
|
80
|
+
duration?: number
|
|
81
|
+
/** 是否启用滚动动画 */
|
|
82
|
+
animated?: boolean
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
21
87
|
interface TaroStatic {
|
|
22
88
|
/** 将页面滚动到目标位置,支持选择器和滚动距离两种方式定位
|
|
23
89
|
*
|
|
24
90
|
* **selector 语法**
|
|
25
91
|
* selector类似于 CSS 的选择器,但仅支持下列语法。
|
|
26
92
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @supported weapp, h5
|
|
93
|
+
* - ID选择器:#the-id
|
|
94
|
+
* - class选择器(可以连续指定多个):.a-class.another-class
|
|
95
|
+
* - 子元素选择器:.the-parent > .the-child
|
|
96
|
+
* - 后代选择器:.the-ancestor .the-descendant
|
|
97
|
+
* - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
|
|
98
|
+
* - 多选择器的并集:#a-node, .some-other-nodes
|
|
99
|
+
* @supported weapp, h5, rn
|
|
34
100
|
* @example
|
|
35
101
|
* ```tsx
|
|
36
102
|
* Taro.pageScrollTo({
|
package/types/api/ui/sticky.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ declare module '../../index' {
|
|
|
5
5
|
interface Option {
|
|
6
6
|
/** 置顶栏文字 */
|
|
7
7
|
text: string
|
|
8
|
-
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
9
|
-
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
-
/** 接口调用失败的回调函数 */
|
|
11
|
-
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
12
8
|
/** 接口调用成功的回调函数 */
|
|
13
9
|
success?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用失败的回调函数 */
|
|
11
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
13
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
interface TaroStatic {
|
|
@@ -121,19 +121,19 @@ declare module '../../index' {
|
|
|
121
121
|
|
|
122
122
|
interface TaroStatic {
|
|
123
123
|
/** 显示 tabBar 某一项的右上角的红点
|
|
124
|
-
* @supported weapp, h5
|
|
124
|
+
* @supported weapp, h5, rn
|
|
125
125
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBarRedDot.html
|
|
126
126
|
*/
|
|
127
127
|
showTabBarRedDot(option: showTabBarRedDot.Option): Promise<TaroGeneral.CallbackResult>
|
|
128
128
|
|
|
129
129
|
/** 显示 tabBar
|
|
130
|
-
* @supported weapp, h5
|
|
130
|
+
* @supported weapp, h5, rn
|
|
131
131
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBar.html
|
|
132
132
|
*/
|
|
133
133
|
showTabBar(option?: showTabBar.Option): Promise<TaroGeneral.CallbackResult>
|
|
134
134
|
|
|
135
135
|
/** 动态设置 tabBar 的整体样式
|
|
136
|
-
* @supported weapp, h5
|
|
136
|
+
* @supported weapp, h5, rn
|
|
137
137
|
* @example
|
|
138
138
|
* ```tsx
|
|
139
139
|
* Taro.setTabBarStyle({
|
|
@@ -163,7 +163,7 @@ declare module '../../index' {
|
|
|
163
163
|
setTabBarItem(option: setTabBarItem.Option): Promise<TaroGeneral.CallbackResult>
|
|
164
164
|
|
|
165
165
|
/** 为 tabBar 某一项的右上角添加文本
|
|
166
|
-
* @supported weapp, h5
|
|
166
|
+
* @supported weapp, h5, rn
|
|
167
167
|
* @example
|
|
168
168
|
* ```tsx
|
|
169
169
|
* Taro.setTabBarBadge({
|
|
@@ -176,19 +176,19 @@ declare module '../../index' {
|
|
|
176
176
|
setTabBarBadge(option: setTabBarBadge.Option): Promise<TaroGeneral.CallbackResult>
|
|
177
177
|
|
|
178
178
|
/** 移除 tabBar 某一项右上角的文本
|
|
179
|
-
* @supported weapp, h5
|
|
179
|
+
* @supported weapp, h5, rn
|
|
180
180
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.removeTabBarBadge.html
|
|
181
181
|
*/
|
|
182
182
|
removeTabBarBadge(option: removeTabBarBadge.Option): Promise<TaroGeneral.CallbackResult>
|
|
183
183
|
|
|
184
184
|
/** 隐藏 tabBar 某一项的右上角的红点
|
|
185
|
-
* @supported weapp, h5
|
|
185
|
+
* @supported weapp, h5, rn
|
|
186
186
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBarRedDot.html
|
|
187
187
|
*/
|
|
188
188
|
hideTabBarRedDot(option: hideTabBarRedDot.Option): Promise<TaroGeneral.CallbackResult>
|
|
189
189
|
|
|
190
190
|
/** 隐藏 tabBar
|
|
191
|
-
* @supported weapp, h5
|
|
191
|
+
* @supported weapp, h5, rn
|
|
192
192
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBar.html
|
|
193
193
|
*/
|
|
194
194
|
hideTabBar(option?: hideTabBar.Option): Promise<TaroGeneral.CallbackResult>
|
package/types/api/ui/window.d.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import Taro from '../../index'
|
|
2
2
|
|
|
3
3
|
declare module '../../index' {
|
|
4
|
+
namespace setWindowSize {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 窗口宽度,以像素为单位 */
|
|
7
|
+
width: string
|
|
8
|
+
/** 窗口高度,以像素为单位 */
|
|
9
|
+
height: string
|
|
10
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
11
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
/** 接口调用失败的回调函数 */
|
|
13
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
14
|
+
/** 接口调用成功的回调函数 */
|
|
15
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
16
|
+
}
|
|
17
|
+
}
|
|
4
18
|
namespace onWindowResize {
|
|
5
19
|
/** 窗口尺寸变化事件的回调函数 */
|
|
6
20
|
type Callback = (result: CallbackResult) => void
|
|
@@ -23,8 +37,14 @@ declare module '../../index' {
|
|
|
23
37
|
}
|
|
24
38
|
|
|
25
39
|
interface TaroStatic {
|
|
40
|
+
/** 设置窗口大小,该接口仅适用于 PC 平台,使用细则请参见指南
|
|
41
|
+
* @supported weapp
|
|
42
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.setWindowSize.html
|
|
43
|
+
*/
|
|
44
|
+
setWindowSize(option: setWindowSize.Option): Promise<TaroGeneral.CallbackResult>
|
|
45
|
+
|
|
26
46
|
/** 监听窗口尺寸变化事件
|
|
27
|
-
* @supported weapp, h5
|
|
47
|
+
* @supported weapp, h5, rn
|
|
28
48
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.onWindowResize.html
|
|
29
49
|
*/
|
|
30
50
|
onWindowResize(
|
|
@@ -33,7 +53,7 @@ declare module '../../index' {
|
|
|
33
53
|
): void
|
|
34
54
|
|
|
35
55
|
/** 取消监听窗口尺寸变化事件
|
|
36
|
-
* @supported weapp, h5
|
|
56
|
+
* @supported weapp, h5, rn
|
|
37
57
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.offWindowResize.html
|
|
38
58
|
*/
|
|
39
59
|
offWindowResize(
|
|
@@ -19,6 +19,14 @@ declare module '../../index' {
|
|
|
19
19
|
/** 主线程/Worker 线程向当前线程发送的消息的事件的回调函数 */
|
|
20
20
|
callback: Worker.OnMessageCallback,
|
|
21
21
|
): void
|
|
22
|
+
/** 监听 worker 线程被系统回收事件(当 iOS 系统资源紧张时,worker 线程存在被系统回收的可能,开发者可监听此事件并重新创建一个 worker)
|
|
23
|
+
* @supported weapp
|
|
24
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onProcessKilled.html
|
|
25
|
+
*/
|
|
26
|
+
onProcessKilled(
|
|
27
|
+
/** worker 线程被系统回收事件的回调函数 */
|
|
28
|
+
callback: Worker.OnMessageCallback,
|
|
29
|
+
): void
|
|
22
30
|
/** 向主线程/Worker 线程发送的消息。
|
|
23
31
|
* @supported weapp
|
|
24
32
|
* @example
|
|
@@ -52,7 +60,7 @@ declare module '../../index' {
|
|
|
52
60
|
}
|
|
53
61
|
|
|
54
62
|
interface TaroStatic {
|
|
55
|
-
/** 创建一个 Worker 线程。目前限制最多只能创建一个 Worker,创建下一个 Worker 前请先调用 [Worker.terminate](
|
|
63
|
+
/** 创建一个 Worker 线程。目前限制最多只能创建一个 Worker,创建下一个 Worker 前请先调用 [Worker.terminate](/docs/apis/worker/Worker#terminate)
|
|
56
64
|
* @supported weapp
|
|
57
65
|
* @example
|
|
58
66
|
* ```tsx
|