@spcsn/taro 0.1.1 → 1.0.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/README.md +13 -6
- package/dist/index.js +223 -1
- package/dist/index.js.map +1 -1
- package/package.json +25 -56
- package/types/api/ad/index.d.ts +3 -6
- package/types/api/base/debug.d.ts +8 -8
- package/types/api/base/env.d.ts +3 -3
- package/types/api/base/index.d.ts +3 -3
- package/types/api/base/performance.d.ts +5 -5
- package/types/api/base/system.d.ts +8 -16
- package/types/api/base/update.d.ts +6 -6
- package/types/api/base/weapp/app-event.d.ts +12 -12
- package/types/api/base/weapp/life-cycle.d.ts +1 -1
- package/types/api/canvas/index.d.ts +71 -72
- package/types/api/data-analysis/index.d.ts +1 -1
- package/types/api/device/accelerometer.d.ts +4 -4
- package/types/api/device/accessibility.d.ts +1 -1
- package/types/api/device/battery.d.ts +2 -2
- package/types/api/device/bluetooth-ble.d.ts +14 -14
- package/types/api/device/bluetooth-peripheral.d.ts +15 -15
- package/types/api/device/bluetooth.d.ts +11 -11
- package/types/api/device/calendar.d.ts +2 -2
- package/types/api/device/clipboard.d.ts +2 -4
- package/types/api/device/compass.d.ts +4 -4
- package/types/api/device/gyroscope.d.ts +4 -4
- package/types/api/device/iBeacon.d.ts +7 -7
- package/types/api/device/keyboard.d.ts +3 -3
- package/types/api/device/memory.d.ts +2 -2
- package/types/api/device/motion.d.ts +4 -4
- package/types/api/device/network.d.ts +5 -20
- package/types/api/device/nfc.d.ts +17 -17
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/scan.d.ts +1 -1
- package/types/api/device/screen.d.ts +6 -6
- package/types/api/device/sms.d.ts +1 -1
- package/types/api/device/vibrate.d.ts +2 -2
- package/types/api/device/wifi.d.ts +10 -10
- package/types/api/ext/index.d.ts +2 -2
- package/types/api/files/index.d.ts +46 -46
- package/types/api/framework/index.d.ts +2 -2
- package/types/api/location/index.d.ts +38 -45
- package/types/api/media/audio.d.ts +30 -30
- package/types/api/media/background-audio.d.ts +1 -1
- package/types/api/media/camera.d.ts +12 -25
- package/types/api/media/image.d.ts +8 -13
- package/types/api/media/map.d.ts +15 -15
- package/types/api/media/recorder.d.ts +11 -11
- package/types/api/media/video.d.ts +19 -21
- package/types/api/navigate/index.d.ts +2 -2
- package/types/api/network/download.d.ts +7 -8
- package/types/api/network/request.d.ts +14 -33
- package/types/api/network/upload.d.ts +7 -9
- package/types/api/network/websocket.d.ts +14 -14
- package/types/api/open-api/account.d.ts +1 -1
- package/types/api/open-api/address.d.ts +5 -5
- package/types/api/open-api/authorize.d.ts +1 -1
- package/types/api/open-api/login.d.ts +5 -5
- package/types/api/open-api/settings.d.ts +2 -2
- package/types/api/open-api/subscribe-message.d.ts +15 -15
- package/types/api/open-api/user-info.d.ts +2 -3
- package/types/api/payment/index.d.ts +1 -1
- package/types/api/route/index.d.ts +5 -8
- package/types/api/share/index.d.ts +3 -3
- package/types/api/storage/background-fetch.d.ts +6 -9
- package/types/api/storage/index.d.ts +11 -11
- package/types/api/taro.extend.d.ts +7 -24
- package/types/api/taro.hooks.d.ts +8 -33
- package/types/api/ui/animation.d.ts +33 -36
- package/types/api/ui/background.d.ts +2 -4
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +1 -10
- package/types/api/ui/interaction.d.ts +6 -6
- package/types/api/ui/menu.d.ts +1 -1
- package/types/api/ui/navigation-bar.d.ts +5 -7
- package/types/api/ui/pull-down-refresh.d.ts +2 -3
- package/types/api/ui/scroll.d.ts +3 -4
- package/types/api/ui/tab-bar.d.ts +8 -8
- package/types/api/ui/window.d.ts +2 -2
- package/types/api/wxml/index.d.ts +19 -23
- package/types/compile/compiler.d.ts +4 -10
- package/types/compile/config/index.d.ts +0 -3
- package/types/compile/config/mini.d.ts +17 -39
- package/types/compile/config/plugin.d.ts +14 -4
- package/types/compile/config/project.d.ts +23 -61
- package/types/compile/config/util.d.ts +18 -73
- package/types/compile/index.d.ts +16 -1
- package/types/compile/viteCompilerContext.d.ts +18 -52
- package/types/global.d.ts +1 -12
- package/types/index.d.ts +0 -11
- package/types/taro.api.d.ts +0 -9
- package/types/taro.component.d.ts +0 -2
- package/types/taro.config.d.ts +0 -120
- package/types/taro.runtime.d.ts +7 -3
- package/types/api/alipay/index.d.ts +0 -69
- package/types/api/qq/index.d.ts +0 -354
- package/types/api/swan/bookshelf.d.ts +0 -307
- package/types/api/swan/download-package.d.ts +0 -80
- package/types/api/swan/index.d.ts +0 -251
- package/types/api/swan/pay.d.ts +0 -139
- package/types/compile/config/h5.d.ts +0 -134
- package/types/compile/config/harmony.d.ts +0 -118
- package/types/compile/config/rn.d.ts +0 -85
|
@@ -27,7 +27,7 @@ declare module '../../index' {
|
|
|
27
27
|
/** 超时时间,单位ms */
|
|
28
28
|
timeout?: number
|
|
29
29
|
/** 未登录时, 是否强制调起登录框
|
|
30
|
-
* @supported
|
|
30
|
+
* @supported weapp
|
|
31
31
|
* @default true
|
|
32
32
|
*/
|
|
33
33
|
force?: boolean
|
|
@@ -38,11 +38,11 @@ declare module '../../index' {
|
|
|
38
38
|
/** 调用结果 */
|
|
39
39
|
errMsg: string
|
|
40
40
|
/** 用于标识当前设备, 无论登录与否都会返回, 有效期 5 分钟。
|
|
41
|
-
* @supported
|
|
41
|
+
* @supported weapp
|
|
42
42
|
*/
|
|
43
43
|
anonymousCode?: string
|
|
44
44
|
/** 判断在当前 APP(头条、抖音等)是否处于登录状态。
|
|
45
|
-
* @supported
|
|
45
|
+
* @supported weapp
|
|
46
46
|
*/
|
|
47
47
|
isLogin?: boolean
|
|
48
48
|
}
|
|
@@ -67,7 +67,7 @@ declare module '../../index' {
|
|
|
67
67
|
pluginLogin(option?: pluginLogin.Option): Promise<pluginLogin.SuccessCallbackResult>
|
|
68
68
|
|
|
69
69
|
/** 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户的唯一标识(openid)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
|
|
70
|
-
* @supported weapp
|
|
70
|
+
* @supported weapp
|
|
71
71
|
* @example
|
|
72
72
|
* ```tsx
|
|
73
73
|
* Taro.login({
|
|
@@ -95,7 +95,7 @@ declare module '../../index' {
|
|
|
95
95
|
* 通过 Taro.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 Taro.checkSession 接口检测当前用户登录态是否有效。
|
|
96
96
|
*
|
|
97
97
|
* 登录态过期后开发者可以再调用 Taro.login 获取新的用户登录态。调用 Taro.checkSession 成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
|
|
98
|
-
* @supported weapp
|
|
98
|
+
* @supported weapp
|
|
99
99
|
* @example
|
|
100
100
|
* ```tsx
|
|
101
101
|
* Taro.checkSession({
|
|
@@ -136,7 +136,7 @@ declare module '../../index' {
|
|
|
136
136
|
/** 调起客户端小程序设置界面,返回用户设置的操作结果。**设置界面只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
|
|
137
137
|
*
|
|
138
138
|
* 注意:[2.3.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为后,才可以跳转打开设置页,管理授权信息。[详情](https://developers.weixin.qq.com/community/develop/doc/000cea2305cc5047af5733de751008)
|
|
139
|
-
* @supported weapp
|
|
139
|
+
* @supported weapp
|
|
140
140
|
* @example
|
|
141
141
|
* ```tsx
|
|
142
142
|
* Taro.openSetting({
|
|
@@ -154,7 +154,7 @@ declare module '../../index' {
|
|
|
154
154
|
openSetting(option?: openSetting.Option): Promise<openSetting.SuccessCallbackResult>
|
|
155
155
|
|
|
156
156
|
/** 获取用户的当前设置。**返回值中只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
|
|
157
|
-
* @supported weapp
|
|
157
|
+
* @supported weapp
|
|
158
158
|
* @example
|
|
159
159
|
* ```tsx
|
|
160
160
|
* Taro.getSetting({
|
|
@@ -5,15 +5,15 @@ declare module '../../index' {
|
|
|
5
5
|
interface BaseOption {
|
|
6
6
|
/**
|
|
7
7
|
* 需要订阅的消息模板的id的集合(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置
|
|
8
|
-
* @supported weapp
|
|
8
|
+
* @supported weapp
|
|
9
9
|
*/
|
|
10
10
|
tmplIds: string[]
|
|
11
11
|
/** 需要订阅的消息模板 id 集合(注意:1、一次性模板 id 和长期性模板 id 不可同时使用,2、一次最多传入三个模板 id
|
|
12
|
-
* @supported
|
|
12
|
+
* @supported weapp
|
|
13
13
|
*/
|
|
14
14
|
entityIds: string[]
|
|
15
15
|
/** 模板小程序 appId,仅在服务商代调用场景下需要传入
|
|
16
|
-
* @supported
|
|
16
|
+
* @supported weapp
|
|
17
17
|
*/
|
|
18
18
|
thirdTypeAppId?: string
|
|
19
19
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
@@ -59,7 +59,7 @@ declare module '../../index' {
|
|
|
59
59
|
* | --- | ---- |
|
|
60
60
|
* | subscribe | 订阅成功 |
|
|
61
61
|
*
|
|
62
|
-
* @supported
|
|
62
|
+
* @supported weapp
|
|
63
63
|
*/
|
|
64
64
|
behavior?: string
|
|
65
65
|
/** 一次性订阅,是否勾选 总是保持以上选择,不再询问。
|
|
@@ -69,7 +69,7 @@ declare module '../../index' {
|
|
|
69
69
|
* | true | 勾选 |
|
|
70
70
|
* | false | 未勾选 |
|
|
71
71
|
*
|
|
72
|
-
* @supported
|
|
72
|
+
* @supported weapp
|
|
73
73
|
*/
|
|
74
74
|
keep?: boolean
|
|
75
75
|
/** 长期性订阅,是否点击 拒绝,不再询问。
|
|
@@ -79,11 +79,11 @@ declare module '../../index' {
|
|
|
79
79
|
* | true | 点击 |
|
|
80
80
|
* | false | 未点击 |
|
|
81
81
|
*
|
|
82
|
-
* @supported
|
|
82
|
+
* @supported weapp
|
|
83
83
|
*/
|
|
84
84
|
refuse?: boolean
|
|
85
85
|
/** 订阅数据
|
|
86
|
-
* @supported
|
|
86
|
+
* @supported weapp
|
|
87
87
|
*/
|
|
88
88
|
result?: ISubscribeResult
|
|
89
89
|
/** 本次订阅过程是否弹出了订阅面板。
|
|
@@ -93,7 +93,7 @@ declare module '../../index' {
|
|
|
93
93
|
* | true | 弹出 |
|
|
94
94
|
* | false | 未弹出 |
|
|
95
95
|
*
|
|
96
|
-
* @supported
|
|
96
|
+
* @supported weapp
|
|
97
97
|
*/
|
|
98
98
|
show?: boolean
|
|
99
99
|
/** 接口调用成功时errMsg值为'requestSubscribeMessage:ok' */
|
|
@@ -115,17 +115,17 @@ declare module '../../index' {
|
|
|
115
115
|
interface TemplateReflex {
|
|
116
116
|
/**
|
|
117
117
|
* 表示用户同意订阅该条id对应的模板消息
|
|
118
|
-
* @supported weapp
|
|
118
|
+
* @supported weapp
|
|
119
119
|
*/
|
|
120
120
|
accept
|
|
121
121
|
/**
|
|
122
122
|
* 表示用户拒绝订阅该条id对应的模板消息
|
|
123
|
-
* @supported weapp
|
|
123
|
+
* @supported weapp
|
|
124
124
|
*/
|
|
125
125
|
reject
|
|
126
126
|
/**
|
|
127
127
|
* 表示已被后台封禁
|
|
128
|
-
* @supported weapp
|
|
128
|
+
* @supported weapp
|
|
129
129
|
*/
|
|
130
130
|
ban
|
|
131
131
|
/**
|
|
@@ -134,7 +134,7 @@ declare module '../../index' {
|
|
|
134
134
|
*/
|
|
135
135
|
filter
|
|
136
136
|
/** 表示该条 id 对应的模版消息授权失败
|
|
137
|
-
* @supported
|
|
137
|
+
* @supported weapp
|
|
138
138
|
*/
|
|
139
139
|
fail
|
|
140
140
|
}
|
|
@@ -217,7 +217,7 @@ declare module '../../index' {
|
|
|
217
217
|
/** 请求订阅消息
|
|
218
218
|
*
|
|
219
219
|
* 注意:[2.8.2](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为或者发起支付回调后,才可以调起订阅消息界面。
|
|
220
|
-
* @supported weapp
|
|
220
|
+
* @supported weapp
|
|
221
221
|
* @example
|
|
222
222
|
* ```tsx
|
|
223
223
|
* Taro.requestSubscribeMessage({
|
|
@@ -255,7 +255,7 @@ declare module '../../index' {
|
|
|
255
255
|
): Promise<requestSubscribeDeviceMessage.SuccessCallbackResult | requestSubscribeDeviceMessage.FailCallbackResult>
|
|
256
256
|
|
|
257
257
|
/** 取消当前用户已订阅的消息
|
|
258
|
-
* @supported
|
|
258
|
+
* @supported weapp
|
|
259
259
|
* @example
|
|
260
260
|
* ```tsx
|
|
261
261
|
* Taro.unsubscribeMessage({
|
|
@@ -276,7 +276,7 @@ declare module '../../index' {
|
|
|
276
276
|
unsubscribeMessage(option: unsubscribeMessage.Option): void
|
|
277
277
|
|
|
278
278
|
/** 小程序消息订阅服务,包括取消订阅和查询订阅;订阅操作详见 [form 表单](https://smartprogram.baidu.com/docs/develop/component/formlist_form/)。
|
|
279
|
-
* @supported
|
|
279
|
+
* @supported weapp
|
|
280
280
|
* @example
|
|
281
281
|
* ```tsx
|
|
282
282
|
* Taro.subscribeService({
|
|
@@ -40,7 +40,6 @@ declare module '../../index' {
|
|
|
40
40
|
/** 声明获取用户个人信息后的用途,不超过30个字符 */
|
|
41
41
|
desc: string
|
|
42
42
|
/** 当宿主未登录时,是否强制拉起登录框
|
|
43
|
-
* @supported tt
|
|
44
43
|
* @default false
|
|
45
44
|
*/
|
|
46
45
|
force?: boolean
|
|
@@ -107,7 +106,7 @@ declare module '../../index' {
|
|
|
107
106
|
*
|
|
108
107
|
* **接口调整说明**
|
|
109
108
|
* 在用户未授权过的情况下调用此接口,将不再出现授权弹窗,会直接进入 fail 回调(详见[《公告》](https://developers.weixin.qq.com/community/develop/doc/0000a26e1aca6012e896a517556c01))。在用户已授权的情况下调用此接口,可成功获取用户信息。
|
|
110
|
-
* @supported weapp
|
|
109
|
+
* @supported weapp
|
|
111
110
|
* @example
|
|
112
111
|
* ```tsx
|
|
113
112
|
* // 必须是在用户已经授权的情况下调用
|
|
@@ -158,7 +157,7 @@ declare module '../../index' {
|
|
|
158
157
|
* 开发者每次通过该接口获取用户个人信息均需用户确认,请开发者妥善保管用户快速填写的头像昵称,避免重复弹窗。
|
|
159
158
|
*
|
|
160
159
|
* [微信端调整背景和说明,请参考文档](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801)
|
|
161
|
-
* @supported weapp
|
|
160
|
+
* @supported weapp
|
|
162
161
|
* @example
|
|
163
162
|
* 推荐使用 Taro.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
|
|
164
163
|
*
|
|
@@ -67,7 +67,7 @@ declare module '../../index' {
|
|
|
67
67
|
|
|
68
68
|
interface TaroStatic {
|
|
69
69
|
/** 发起微信支付。了解更多信息,请查看[微信支付接口文档](https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_3&index=1)
|
|
70
|
-
* @supported weapp
|
|
70
|
+
* @supported weapp
|
|
71
71
|
* @example
|
|
72
72
|
* ```tsx
|
|
73
73
|
* Taro.requestPayment({
|
|
@@ -220,7 +220,7 @@ declare module '../../index' {
|
|
|
220
220
|
|
|
221
221
|
interface TaroStatic {
|
|
222
222
|
/** 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
|
|
223
|
-
* @supported weapp
|
|
223
|
+
* @supported weapp
|
|
224
224
|
* @example
|
|
225
225
|
* ```json
|
|
226
226
|
* {
|
|
@@ -246,7 +246,7 @@ declare module '../../index' {
|
|
|
246
246
|
switchTab(option: switchTab.Option): Promise<TaroGeneral.CallbackResult>
|
|
247
247
|
|
|
248
248
|
/** 关闭所有页面,打开到应用内的某个页面
|
|
249
|
-
* @supported weapp
|
|
249
|
+
* @supported weapp
|
|
250
250
|
* @example
|
|
251
251
|
* ```tsx
|
|
252
252
|
* Taro.reLaunch({
|
|
@@ -258,8 +258,7 @@ declare module '../../index' {
|
|
|
258
258
|
reLaunch(option: reLaunch.Option): Promise<TaroGeneral.CallbackResult>
|
|
259
259
|
|
|
260
260
|
/** 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。
|
|
261
|
-
* @supported weapp
|
|
262
|
-
* @h5 未针对 tabbar 页面做限制处理
|
|
261
|
+
* @supported weapp
|
|
263
262
|
* @example
|
|
264
263
|
* ```tsx
|
|
265
264
|
* Taro.redirectTo({
|
|
@@ -271,8 +270,7 @@ declare module '../../index' {
|
|
|
271
270
|
redirectTo(option: redirectTo.Option): Promise<TaroGeneral.CallbackResult>
|
|
272
271
|
|
|
273
272
|
/** 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 Taro.navigateBack 可以返回到原页面。小程序中页面栈最多十层。
|
|
274
|
-
* @supported weapp
|
|
275
|
-
* @h5 未针对 tabbar 页面做限制处理
|
|
273
|
+
* @supported weapp
|
|
276
274
|
* @example
|
|
277
275
|
* ```tsx
|
|
278
276
|
* Taro.navigateTo({
|
|
@@ -298,8 +296,7 @@ declare module '../../index' {
|
|
|
298
296
|
navigateTo(option: navigateTo.Option): Promise<TaroGeneral.CallbackResult>
|
|
299
297
|
|
|
300
298
|
/** 关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages 获取当前的页面栈,决定需要返回几层。
|
|
301
|
-
* @supported weapp
|
|
302
|
-
* @h5 若入参 delta 大于现有页面数时,返回应用打开的第一个页面(如果想要返回首页请使用 reLaunch 方法)。
|
|
299
|
+
* @supported weapp
|
|
303
300
|
* @example
|
|
304
301
|
* ```tsx
|
|
305
302
|
* // 注意:调用 navigateTo 跳转时,调用该方法的页面会被加入堆栈,而 redirectTo 方法则不会。见下方示例代码
|
|
@@ -70,7 +70,7 @@ declare module '../../index' {
|
|
|
70
70
|
/** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
|
|
71
71
|
withShareTicket?: boolean
|
|
72
72
|
/** QQ小程序分享功能,支持分享到QQ、QQ空间、微信好友、微信朋友圈
|
|
73
|
-
* @supported weapp
|
|
73
|
+
* @supported weapp
|
|
74
74
|
* @qq QQ支持的值: ['qq', 'qzone', 'wechatFriends', 'wechatMoment']
|
|
75
75
|
* @weapp 微信支持:['wechatFriends', 'wechatMoment'] / ['shareAppMessage', 'shareTimeline']
|
|
76
76
|
*/
|
|
@@ -208,7 +208,7 @@ declare module '../../index' {
|
|
|
208
208
|
updateShareMenu (option: updateShareMenu.Option): Promise<TaroGeneral.CallbackResult>
|
|
209
209
|
|
|
210
210
|
/** 显示当前页面的转发按钮
|
|
211
|
-
* @supported weapp
|
|
211
|
+
* @supported weapp
|
|
212
212
|
* @example
|
|
213
213
|
* ```tsx
|
|
214
214
|
* Taro.showShareMenu({
|
|
@@ -300,7 +300,7 @@ declare module '../../index' {
|
|
|
300
300
|
): void
|
|
301
301
|
|
|
302
302
|
/** 隐藏当前页面的转发按钮
|
|
303
|
-
* @supported weapp
|
|
303
|
+
* @supported weapp
|
|
304
304
|
* @example
|
|
305
305
|
* ```tsx
|
|
306
306
|
* Taro.hideShareMenu()
|
|
@@ -67,8 +67,6 @@ declare module '../../index' {
|
|
|
67
67
|
interface Option {
|
|
68
68
|
/** 缓存数据类别
|
|
69
69
|
* @weapp 取值为 periodic
|
|
70
|
-
* @qq 取值为 periodic
|
|
71
|
-
* @alipay 取值为 pre: 数据预拉取; jsapiPre: API 预调用(目前仅支持地理位置预拉取)
|
|
72
70
|
*/
|
|
73
71
|
fetchType: string
|
|
74
72
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
@@ -81,7 +79,6 @@ declare module '../../index' {
|
|
|
81
79
|
|
|
82
80
|
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
83
81
|
/** 缓存数据
|
|
84
|
-
* @alipay Object
|
|
85
82
|
*/
|
|
86
83
|
fetchedData: string | Object
|
|
87
84
|
/** 客户端拿到缓存数据的时间戳 ms。(iOS 时间戳存在异常,8.0.27 修复) */
|
|
@@ -93,11 +90,11 @@ declare module '../../index' {
|
|
|
93
90
|
/** 进入小程序的场景值 */
|
|
94
91
|
scene: number
|
|
95
92
|
/** 缓存数据类型,与入参 fetchType 一致
|
|
96
|
-
* @supported
|
|
93
|
+
* @supported weapp
|
|
97
94
|
*/
|
|
98
95
|
fetchType?: string
|
|
99
96
|
/** 缓存数据的时间戳。单位:ms。
|
|
100
|
-
* @supported
|
|
97
|
+
* @supported weapp
|
|
101
98
|
*/
|
|
102
99
|
timestamp?: number
|
|
103
100
|
}
|
|
@@ -105,25 +102,25 @@ declare module '../../index' {
|
|
|
105
102
|
|
|
106
103
|
interface TaroStatic {
|
|
107
104
|
/** 设置自定义登录态,在周期性拉取数据时带上,便于第三方服务器验证请求合法性
|
|
108
|
-
* @supported weapp
|
|
105
|
+
* @supported weapp
|
|
109
106
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.setBackgroundFetchToken.html
|
|
110
107
|
*/
|
|
111
108
|
setBackgroundFetchToken(option: setBackgroundFetchToken.Option): Promise<TaroGeneral.CallbackResult>
|
|
112
109
|
|
|
113
110
|
/** 收到 backgroundFetch 数据时的回调
|
|
114
|
-
* @supported weapp
|
|
111
|
+
* @supported weapp
|
|
115
112
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.onBackgroundFetchData.html
|
|
116
113
|
*/
|
|
117
114
|
onBackgroundFetchData(option?: onBackgroundFetchData.Option | onBackgroundFetchData.Callback): void
|
|
118
115
|
|
|
119
116
|
/** 获取设置过的自定义登录态。若无,则返回 fail。
|
|
120
|
-
* @supported weapp
|
|
117
|
+
* @supported weapp
|
|
121
118
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchToken.html
|
|
122
119
|
*/
|
|
123
120
|
getBackgroundFetchToken(option?: getBackgroundFetchToken.Option): Promise<TaroGeneral.CallbackResult>
|
|
124
121
|
|
|
125
122
|
/** 拉取 backgroundFetch 客户端缓存数据
|
|
126
|
-
* @supported weapp
|
|
123
|
+
* @supported weapp
|
|
127
124
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchData.html
|
|
128
125
|
*/
|
|
129
126
|
getBackgroundFetchData(option: getBackgroundFetchData.Option): Promise<getBackgroundFetchData.SuccessCallbackResult>
|
|
@@ -50,7 +50,7 @@ declare module '../../index' {
|
|
|
50
50
|
/** 限制的空间大小,单位 KB */
|
|
51
51
|
limitSize: number
|
|
52
52
|
/** 是否执行成功
|
|
53
|
-
* @supported
|
|
53
|
+
* @supported weapp
|
|
54
54
|
*/
|
|
55
55
|
success?: boolean
|
|
56
56
|
}
|
|
@@ -153,7 +153,7 @@ declare module '../../index' {
|
|
|
153
153
|
|
|
154
154
|
interface TaroStatic {
|
|
155
155
|
/** Taro.setStorage 的同步版本
|
|
156
|
-
* @supported weapp
|
|
156
|
+
* @supported weapp
|
|
157
157
|
* @example
|
|
158
158
|
* ```tsx
|
|
159
159
|
* Taro.setStorage({
|
|
@@ -177,7 +177,7 @@ declare module '../../index' {
|
|
|
177
177
|
): void
|
|
178
178
|
|
|
179
179
|
/** 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
|
|
180
|
-
* @supported weapp
|
|
180
|
+
* @supported weapp
|
|
181
181
|
* @example
|
|
182
182
|
* ```tsx
|
|
183
183
|
* Taro.setStorage({
|
|
@@ -204,7 +204,7 @@ declare module '../../index' {
|
|
|
204
204
|
): void
|
|
205
205
|
|
|
206
206
|
/** Taro.removeStorage 的同步版本
|
|
207
|
-
* @supported weapp
|
|
207
|
+
* @supported weapp
|
|
208
208
|
* @example
|
|
209
209
|
* ```tsx
|
|
210
210
|
* try {
|
|
@@ -221,7 +221,7 @@ declare module '../../index' {
|
|
|
221
221
|
): void
|
|
222
222
|
|
|
223
223
|
/** 从本地缓存中移除指定 key
|
|
224
|
-
* @supported weapp
|
|
224
|
+
* @supported weapp
|
|
225
225
|
* @example
|
|
226
226
|
* ```tsx
|
|
227
227
|
* Taro.removeStorage({
|
|
@@ -236,7 +236,7 @@ declare module '../../index' {
|
|
|
236
236
|
removeStorage(option: removeStorage.Option): Promise<TaroGeneral.CallbackResult>
|
|
237
237
|
|
|
238
238
|
/** Taro.getStorage 的同步版本
|
|
239
|
-
* @supported weapp
|
|
239
|
+
* @supported weapp
|
|
240
240
|
* @example
|
|
241
241
|
* ```tsx
|
|
242
242
|
* try {
|
|
@@ -256,7 +256,7 @@ declare module '../../index' {
|
|
|
256
256
|
): T
|
|
257
257
|
|
|
258
258
|
/** Taro.getStorageInfo 的同步版本
|
|
259
|
-
* @supported weapp
|
|
259
|
+
* @supported weapp
|
|
260
260
|
* @example
|
|
261
261
|
* ```tsx
|
|
262
262
|
* try {
|
|
@@ -273,7 +273,7 @@ declare module '../../index' {
|
|
|
273
273
|
getStorageInfoSync(): getStorageInfoSync.Option
|
|
274
274
|
|
|
275
275
|
/** 异步获取当前storage的相关信息
|
|
276
|
-
* @supported weapp
|
|
276
|
+
* @supported weapp
|
|
277
277
|
* @example
|
|
278
278
|
* ```tsx
|
|
279
279
|
* Taro.getStorageInfo({
|
|
@@ -289,7 +289,7 @@ declare module '../../index' {
|
|
|
289
289
|
getStorageInfo(option?: getStorageInfo.Option): Promise<TaroGeneral.CallbackResult>
|
|
290
290
|
|
|
291
291
|
/** 从本地缓存中异步获取指定 key 的内容
|
|
292
|
-
* @supported weapp
|
|
292
|
+
* @supported weapp
|
|
293
293
|
* @example
|
|
294
294
|
* ```tsx
|
|
295
295
|
* Taro.getStorage({
|
|
@@ -313,7 +313,7 @@ declare module '../../index' {
|
|
|
313
313
|
): string
|
|
314
314
|
|
|
315
315
|
/** Taro.clearStorage 的同步版本
|
|
316
|
-
* @supported weapp
|
|
316
|
+
* @supported weapp
|
|
317
317
|
* @example
|
|
318
318
|
* ```tsx
|
|
319
319
|
* try {
|
|
@@ -327,7 +327,7 @@ declare module '../../index' {
|
|
|
327
327
|
clearStorageSync(): void
|
|
328
328
|
|
|
329
329
|
/** 清理本地数据缓存
|
|
330
|
-
* @supported weapp
|
|
330
|
+
* @supported weapp
|
|
331
331
|
* @example
|
|
332
332
|
* ```tsx
|
|
333
333
|
* Taro.clearStorage()
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
1
|
import Taro from '../index'
|
|
4
2
|
|
|
5
3
|
declare module '../index' {
|
|
@@ -21,15 +19,11 @@ declare module '../index' {
|
|
|
21
19
|
onHide: string
|
|
22
20
|
onShow: string
|
|
23
21
|
preloadData?: Record<any, any>
|
|
24
|
-
/**
|
|
25
|
-
* RN 私有对象 navigationRef,用于使用底层接口控制路由
|
|
26
|
-
*/
|
|
27
|
-
rnNavigationRef?: React.RefObject<any>
|
|
28
22
|
}
|
|
29
23
|
}
|
|
30
24
|
|
|
31
25
|
namespace setGlobalDataPlugin {
|
|
32
|
-
/**
|
|
26
|
+
/** 用于设置 `getApp()` 中的全局变量 */
|
|
33
27
|
interface Plugin {
|
|
34
28
|
install(app: any, data: any): void
|
|
35
29
|
}
|
|
@@ -38,17 +32,6 @@ declare module '../index' {
|
|
|
38
32
|
/** @ignore */
|
|
39
33
|
interface TARO_ENV_TYPE {
|
|
40
34
|
[TaroGeneral.ENV_TYPE.WEAPP]: TaroGeneral.ENV_TYPE.WEAPP
|
|
41
|
-
[TaroGeneral.ENV_TYPE.SWAN]: TaroGeneral.ENV_TYPE.SWAN
|
|
42
|
-
[TaroGeneral.ENV_TYPE.ALIPAY]: TaroGeneral.ENV_TYPE.ALIPAY
|
|
43
|
-
[TaroGeneral.ENV_TYPE.TT]: TaroGeneral.ENV_TYPE.TT
|
|
44
|
-
[TaroGeneral.ENV_TYPE.QQ]: TaroGeneral.ENV_TYPE.QQ
|
|
45
|
-
[TaroGeneral.ENV_TYPE.JD]: TaroGeneral.ENV_TYPE.JD
|
|
46
|
-
[TaroGeneral.ENV_TYPE.WEB]: TaroGeneral.ENV_TYPE.WEB
|
|
47
|
-
[TaroGeneral.ENV_TYPE.RN]: TaroGeneral.ENV_TYPE.RN
|
|
48
|
-
[TaroGeneral.ENV_TYPE.HARMONY]: TaroGeneral.ENV_TYPE.HARMONY
|
|
49
|
-
[TaroGeneral.ENV_TYPE.QUICKAPP]: TaroGeneral.ENV_TYPE.QUICKAPP
|
|
50
|
-
[TaroGeneral.ENV_TYPE.HARMONYHYBRID]: TaroGeneral.ENV_TYPE.HARMONYHYBRID
|
|
51
|
-
[TaroGeneral.ENV_TYPE.ASCF]: TaroGeneral.ENV_TYPE.ASCF
|
|
52
35
|
}
|
|
53
36
|
|
|
54
37
|
namespace interceptorify {
|
|
@@ -101,7 +84,7 @@ declare module '../index' {
|
|
|
101
84
|
}): void
|
|
102
85
|
|
|
103
86
|
/** 小程序获取和 Taro 相关的 App 信息
|
|
104
|
-
* @supported weapp
|
|
87
|
+
* @supported weapp
|
|
105
88
|
*/
|
|
106
89
|
getAppInfo(): getAppInfo.AppInfo
|
|
107
90
|
|
|
@@ -129,7 +112,7 @@ declare module '../index' {
|
|
|
129
112
|
}
|
|
130
113
|
|
|
131
114
|
/** 小程序引用插件 JS 接口
|
|
132
|
-
* @supported weapp
|
|
115
|
+
* @supported weapp
|
|
133
116
|
*/
|
|
134
117
|
requirePlugin: {
|
|
135
118
|
(pluginName: string): any
|
|
@@ -147,8 +130,8 @@ declare module '../index' {
|
|
|
147
130
|
/** @ignore */
|
|
148
131
|
Current: getCurrentInstance.Current
|
|
149
132
|
|
|
150
|
-
/**
|
|
151
|
-
* @supported weapp
|
|
133
|
+
/** 用于设置 `getApp()` 中的全局变量
|
|
134
|
+
* @supported weapp
|
|
152
135
|
* @example
|
|
153
136
|
* ```js
|
|
154
137
|
* // 使用插件
|
|
@@ -162,8 +145,8 @@ declare module '../index' {
|
|
|
162
145
|
*/
|
|
163
146
|
setGlobalDataPlugin: setGlobalDataPlugin.Plugin
|
|
164
147
|
|
|
165
|
-
/** 获取自定义 TabBar 对应的 React
|
|
166
|
-
* @supported weapp
|
|
148
|
+
/** 获取自定义 TabBar 对应的 React 组件实例
|
|
149
|
+
* @supported weapp
|
|
167
150
|
* @param page 小程序页面对象,可以通过 Taro.getCurrentInstance().page 获取
|
|
168
151
|
*/
|
|
169
152
|
getTabBar<T>(page: getCurrentInstance.Current['page']): T | undefined
|
|
@@ -46,7 +46,7 @@ declare module '../index' {
|
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* 当前是 tab 页时,tab 被点击时的回调。
|
|
49
|
-
* @supported weapp
|
|
49
|
+
* @supported weapp
|
|
50
50
|
*/
|
|
51
51
|
useTabItemTap(callback: (payload: TabItemTapObject) => void): void
|
|
52
52
|
|
|
@@ -73,45 +73,44 @@ declare module '../index' {
|
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* 小程序初始化完成时的回调。
|
|
76
|
-
* @supported weapp
|
|
76
|
+
* @supported weapp
|
|
77
77
|
*/
|
|
78
78
|
useLaunch(callback: (options: getLaunchOptionsSync.LaunchOptions) => void): void
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* 小程序发生脚本错误或 API 调用报错时触发的回调。
|
|
82
|
-
* @supported weapp
|
|
82
|
+
* @supported weapp
|
|
83
83
|
*/
|
|
84
84
|
useError(callback: (error: string) => void): void
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* 小程序有未处理的 Promise reject 时触发。也可以使用 Taro.onUnhandledRejection 绑定监听。
|
|
88
|
-
* @supported weapp
|
|
88
|
+
* @supported weapp
|
|
89
89
|
*/
|
|
90
90
|
useUnhandledRejection(callback: (error: { reason: Error, promise: Promise<Error> }) => void): void
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* 小程序要打开的页面不存在时触发的回调。
|
|
94
|
-
* @supported weapp
|
|
95
|
-
* @h5 多页面模式不支持该方法
|
|
94
|
+
* @supported weapp
|
|
96
95
|
*/
|
|
97
96
|
usePageNotFound(callback: (res: { path: string, query: Record<any, any>, isEntryPage: boolean, [key: string]: any }) => void): void
|
|
98
97
|
|
|
99
98
|
/**
|
|
100
99
|
* 页面加载完成时的回调。
|
|
101
|
-
* @supported weapp
|
|
100
|
+
* @supported weapp
|
|
102
101
|
*/
|
|
103
102
|
useLoad<T extends {} = Record<string, any>>(callback: (param: T) => void): void
|
|
104
103
|
|
|
105
104
|
/**
|
|
106
105
|
* 页面卸载时的回调。
|
|
107
|
-
* @supported weapp
|
|
106
|
+
* @supported weapp
|
|
108
107
|
*/
|
|
109
108
|
useUnload(callback: () => void): void
|
|
110
109
|
|
|
111
110
|
/**
|
|
112
111
|
* 页面初次渲染完成的回调。
|
|
113
112
|
* 此时页面已经准备妥当,可以和视图层进行交互。
|
|
114
|
-
* @supported weapp
|
|
113
|
+
* @supported weapp
|
|
115
114
|
*/
|
|
116
115
|
useReady(callback: () => void): void
|
|
117
116
|
|
|
@@ -120,29 +119,5 @@ declare module '../index' {
|
|
|
120
119
|
* @supported global
|
|
121
120
|
*/
|
|
122
121
|
useRouter<TParams extends Partial<Record<string, string>> = Partial<Record<string, string>>>(dynamic?: boolean): RouterInfo<TParams>
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* 导航栏的标题被点击时的回调。
|
|
126
|
-
* @supported alipay
|
|
127
|
-
*/
|
|
128
|
-
useTitleClick(callback: () => void): void
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* 导航栏的额外图标被点击时的回调。
|
|
132
|
-
* @supported alipay
|
|
133
|
-
*/
|
|
134
|
-
useOptionMenuClick(callback: () => void): void
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* 键盘高度变化时的回调。
|
|
138
|
-
* @supported alipay
|
|
139
|
-
*/
|
|
140
|
-
useKeyboardHeight(callback: (payload: { height: number }) => void): void
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* 下拉中断时的回调。
|
|
144
|
-
* @supported alipay, h5, harmony_hybrid
|
|
145
|
-
*/
|
|
146
|
-
usePullIntercept(callback: () => void): void
|
|
147
122
|
}
|
|
148
123
|
}
|