@spcsn/taro 0.1.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 +12 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/index.js +9 -0
- package/package.json +86 -0
- package/types/api/ad/index.d.ts +197 -0
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/inference.d.ts +129 -0
- package/types/api/ai/visionkit.d.ts +874 -0
- package/types/api/alipay/index.d.ts +69 -0
- package/types/api/base/crypto.d.ts +104 -0
- package/types/api/base/debug.d.ts +329 -0
- package/types/api/base/env.d.ts +19 -0
- package/types/api/base/index.d.ts +102 -0
- package/types/api/base/performance.d.ts +258 -0
- package/types/api/base/system.d.ts +742 -0
- package/types/api/base/update.d.ts +130 -0
- package/types/api/base/weapp/app-event.d.ts +265 -0
- package/types/api/base/weapp/life-cycle.d.ts +155 -0
- package/types/api/canvas/index.d.ts +2162 -0
- package/types/api/cloud/index.d.ts +2622 -0
- package/types/api/data-analysis/index.d.ts +122 -0
- package/types/api/device/accelerometer.d.ts +102 -0
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +46 -0
- package/types/api/device/bluetooth-ble.d.ts +601 -0
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +463 -0
- package/types/api/device/calendar.d.ts +98 -0
- package/types/api/device/clipboard.d.ts +81 -0
- package/types/api/device/compass.d.ts +105 -0
- package/types/api/device/contact.d.ts +110 -0
- package/types/api/device/gyroscope.d.ts +85 -0
- package/types/api/device/iBeacon.d.ts +168 -0
- package/types/api/device/keyboard.d.ts +97 -0
- package/types/api/device/memory.d.ts +52 -0
- package/types/api/device/motion.d.ts +88 -0
- package/types/api/device/network.d.ts +172 -0
- package/types/api/device/nfc.d.ts +1238 -0
- package/types/api/device/phone.d.ts +30 -0
- package/types/api/device/scan.d.ts +111 -0
- package/types/api/device/screen.d.ts +217 -0
- package/types/api/device/sms.d.ts +26 -0
- package/types/api/device/vibrate.d.ts +51 -0
- package/types/api/device/wifi.d.ts +301 -0
- package/types/api/ext/index.d.ts +64 -0
- package/types/api/files/index.d.ts +1472 -0
- package/types/api/framework/index.d.ts +51 -0
- package/types/api/location/index.d.ts +517 -0
- package/types/api/media/audio.d.ts +1013 -0
- package/types/api/media/background-audio.d.ts +291 -0
- package/types/api/media/camera.d.ts +207 -0
- package/types/api/media/editor.d.ts +239 -0
- package/types/api/media/image.d.ts +469 -0
- package/types/api/media/live.d.ts +461 -0
- package/types/api/media/map.d.ts +638 -0
- package/types/api/media/media-recorder.d.ts +117 -0
- package/types/api/media/recorder.d.ts +317 -0
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +84 -0
- package/types/api/media/video.d.ts +527 -0
- package/types/api/media/voip.d.ts +393 -0
- package/types/api/navigate/index.d.ts +327 -0
- package/types/api/network/download.d.ts +173 -0
- package/types/api/network/mdns.d.ts +191 -0
- package/types/api/network/request.d.ts +480 -0
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +218 -0
- package/types/api/network/upload.d.ts +201 -0
- package/types/api/network/websocket.d.ts +383 -0
- package/types/api/open-api/account.d.ts +51 -0
- package/types/api/open-api/address.d.ts +68 -0
- package/types/api/open-api/authorize.d.ts +80 -0
- package/types/api/open-api/card.d.ts +110 -0
- package/types/api/open-api/channels.d.ts +225 -0
- package/types/api/open-api/customer-service.d.ts +45 -0
- package/types/api/open-api/device-voip.d.ts +103 -0
- package/types/api/open-api/facial.d.ts +98 -0
- package/types/api/open-api/favorites.d.ts +101 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +87 -0
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +115 -0
- package/types/api/open-api/my-miniprogram.d.ts +28 -0
- package/types/api/open-api/privacy.d.ts +107 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +174 -0
- package/types/api/open-api/soter.d.ts +184 -0
- package/types/api/open-api/sticker.d.ts +83 -0
- package/types/api/open-api/subscribe-message.d.ts +305 -0
- package/types/api/open-api/user-info.d.ts +182 -0
- package/types/api/open-api/werun.d.ts +101 -0
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/qq/index.d.ts +354 -0
- package/types/api/route/index.d.ts +324 -0
- package/types/api/share/index.d.ts +354 -0
- package/types/api/skyline/index.d.ts +345 -0
- package/types/api/storage/background-fetch.d.ts +131 -0
- package/types/api/storage/cache-manager.d.ts +249 -0
- package/types/api/storage/index.d.ts +405 -0
- package/types/api/swan/bookshelf.d.ts +307 -0
- package/types/api/swan/download-package.d.ts +80 -0
- package/types/api/swan/index.d.ts +251 -0
- package/types/api/swan/pay.d.ts +139 -0
- package/types/api/taro.extend.d.ts +233 -0
- package/types/api/taro.hooks.d.ts +148 -0
- package/types/api/ui/animation.d.ts +427 -0
- package/types/api/ui/background.d.ts +69 -0
- package/types/api/ui/custom-component.d.ts +23 -0
- package/types/api/ui/fonts.d.ts +77 -0
- package/types/api/ui/interaction.d.ts +281 -0
- package/types/api/ui/menu.d.ts +29 -0
- package/types/api/ui/navigation-bar.d.ts +130 -0
- package/types/api/ui/pull-down-refresh.d.ts +50 -0
- package/types/api/ui/scroll.d.ts +114 -0
- package/types/api/ui/sticky.d.ts +32 -0
- package/types/api/ui/tab-bar.d.ts +196 -0
- package/types/api/ui/window.d.ts +71 -0
- package/types/api/worker/index.d.ts +83 -0
- package/types/api/wxml/index.d.ts +540 -0
- package/types/compile/compiler.d.ts +32 -0
- package/types/compile/config/h5.d.ts +134 -0
- package/types/compile/config/harmony.d.ts +118 -0
- package/types/compile/config/index.d.ts +8 -0
- package/types/compile/config/manifest.d.ts +155 -0
- package/types/compile/config/mini.d.ts +118 -0
- package/types/compile/config/plugin.d.ts +34 -0
- package/types/compile/config/project.d.ts +338 -0
- package/types/compile/config/rn.d.ts +85 -0
- package/types/compile/config/util.d.ts +179 -0
- package/types/compile/hooks.d.ts +13 -0
- package/types/compile/index.d.ts +11 -0
- package/types/compile/viteCompilerContext.d.ts +167 -0
- package/types/global.d.ts +428 -0
- package/types/index.d.ts +190 -0
- package/types/taro.api.d.ts +130 -0
- package/types/taro.component.d.ts +168 -0
- package/types/taro.config.d.ts +712 -0
- package/types/taro.lifecycle.d.ts +220 -0
- package/types/taro.runtime.d.ts +9 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace showToast {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 提示的内容 */
|
|
7
|
+
title: string
|
|
8
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
9
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 提示的延迟时间 */
|
|
11
|
+
duration?: number
|
|
12
|
+
/** 接口调用失败的回调函数 */
|
|
13
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
14
|
+
/** 图标
|
|
15
|
+
*
|
|
16
|
+
* 可选值:
|
|
17
|
+
* - 'success': 显示成功图标,此时 title 文本最多显示 7 个汉字长度;
|
|
18
|
+
* - 'error': 显示失败图标,此时 title 文本最多显示 7 个汉字长度;
|
|
19
|
+
* - 'loading': 显示加载图标,此时 title 文本最多显示 7 个汉字长度;
|
|
20
|
+
* - 'none': 不显示图标,此时 title 文本最多可显示两行 */
|
|
21
|
+
icon?: 'success' | 'error' | 'loading' | 'none'
|
|
22
|
+
/** 自定义图标的本地路径,image 的优先级高于 icon */
|
|
23
|
+
image?: string
|
|
24
|
+
/** 是否显示透明蒙层,防止触摸穿透 */
|
|
25
|
+
mask?: boolean
|
|
26
|
+
/** 接口调用成功的回调函数 */
|
|
27
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
namespace showModal {
|
|
32
|
+
interface Option {
|
|
33
|
+
/** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
|
|
34
|
+
cancelColor?: string
|
|
35
|
+
/** 取消按钮的文字,最多 4 个字符 */
|
|
36
|
+
cancelText?: string
|
|
37
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
38
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
39
|
+
/** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
|
|
40
|
+
confirmColor?: string
|
|
41
|
+
/** 确认按钮的文字,最多 4 个字符 */
|
|
42
|
+
confirmText?: string
|
|
43
|
+
/** 提示的内容 */
|
|
44
|
+
content?: string
|
|
45
|
+
/** 接口调用失败的回调函数 */
|
|
46
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
47
|
+
/** 是否显示取消按钮 */
|
|
48
|
+
showCancel?: boolean
|
|
49
|
+
/** 接口调用成功的回调函数 */
|
|
50
|
+
success?: (result: SuccessCallbackResult) => void
|
|
51
|
+
/** 提示的标题 */
|
|
52
|
+
title?: string
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
56
|
+
/** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) */
|
|
57
|
+
cancel: boolean
|
|
58
|
+
/** 为 true 时,表示用户点击了确定按钮 */
|
|
59
|
+
confirm: boolean
|
|
60
|
+
/** 调用结果 */
|
|
61
|
+
errMsg: string
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
namespace showLoading {
|
|
66
|
+
interface Option {
|
|
67
|
+
/** 提示的内容 */
|
|
68
|
+
title: string
|
|
69
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
70
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
71
|
+
/** 接口调用失败的回调函数 */
|
|
72
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
73
|
+
/** 是否显示透明蒙层,防止触摸穿透 */
|
|
74
|
+
mask?: boolean
|
|
75
|
+
/** 接口调用成功的回调函数 */
|
|
76
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
namespace showActionSheet {
|
|
81
|
+
interface Option {
|
|
82
|
+
/** 警示文案 */
|
|
83
|
+
alertText?: string
|
|
84
|
+
/** 按钮的文字数组,数组长度最大为 6 */
|
|
85
|
+
itemList: string[]
|
|
86
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
87
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
88
|
+
/** 接口调用失败的回调函数 */
|
|
89
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
90
|
+
/** 按钮的文字颜色 */
|
|
91
|
+
itemColor?: string
|
|
92
|
+
/** 接口调用成功的回调函数 */
|
|
93
|
+
success?: (result: SuccessCallbackResult) => void
|
|
94
|
+
}
|
|
95
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
96
|
+
/** 用户点击的按钮序号,从上到下的顺序,从0开始 */
|
|
97
|
+
tapIndex: number
|
|
98
|
+
/** 调用结果 */
|
|
99
|
+
errMsg: string
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
namespace hideToast {
|
|
104
|
+
interface Option {
|
|
105
|
+
/** 目前 toast 和 loading 相关接口可以相互混用,此参数可用于取消混用特性
|
|
106
|
+
* @default false
|
|
107
|
+
*/
|
|
108
|
+
noConflict?: boolean
|
|
109
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
110
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
111
|
+
/** 接口调用失败的回调函数 */
|
|
112
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
113
|
+
/** 接口调用成功的回调函数 */
|
|
114
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
namespace hideLoading {
|
|
119
|
+
interface Option {
|
|
120
|
+
/** 目前 toast 和 loading 相关接口可以相互混用,此参数可用于取消混用特性
|
|
121
|
+
* @default false
|
|
122
|
+
*/
|
|
123
|
+
noConflict?: boolean
|
|
124
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
125
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
126
|
+
/** 接口调用失败的回调函数 */
|
|
127
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
128
|
+
/** 接口调用成功的回调函数 */
|
|
129
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
namespace enableAlertBeforeUnload {
|
|
134
|
+
interface Option {
|
|
135
|
+
/** 询问对话框内容 */
|
|
136
|
+
message: string
|
|
137
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
138
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
139
|
+
/** 接口调用失败的回调函数 */
|
|
140
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
141
|
+
/** 接口调用成功的回调函数 */
|
|
142
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
namespace disableAlertBeforeUnload {
|
|
147
|
+
interface Option {
|
|
148
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
149
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
150
|
+
/** 接口调用失败的回调函数 */
|
|
151
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
152
|
+
/** 接口调用成功的回调函数 */
|
|
153
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
interface TaroStatic {
|
|
158
|
+
/** 显示消息提示框
|
|
159
|
+
*
|
|
160
|
+
* **注意**
|
|
161
|
+
* - Taro.showLoading 和 Taro.showToast 同时只能显示一个
|
|
162
|
+
* - Taro.showToast 应与 Taro.hideToast 配对使用
|
|
163
|
+
* @supported weapp, h5, rn, tt, harmony, harmony_hybrid
|
|
164
|
+
* @example
|
|
165
|
+
* ```tsx
|
|
166
|
+
* Taro.showToast({
|
|
167
|
+
* title: '成功',
|
|
168
|
+
* icon: 'success',
|
|
169
|
+
* duration: 2000
|
|
170
|
+
* })
|
|
171
|
+
* ```
|
|
172
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html
|
|
173
|
+
*/
|
|
174
|
+
showToast(option?: showToast.Option): Promise<TaroGeneral.CallbackResult>
|
|
175
|
+
|
|
176
|
+
/** 显示模态对话框
|
|
177
|
+
* **注意**
|
|
178
|
+
* - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel";
|
|
179
|
+
* - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑
|
|
180
|
+
* @supported weapp, swan, h5, rn, tt, harmony, harmony_hybrid
|
|
181
|
+
* @example
|
|
182
|
+
* ```tsx
|
|
183
|
+
* Taro.showModal({
|
|
184
|
+
* title: '提示',
|
|
185
|
+
* content: '这是一个模态弹窗',
|
|
186
|
+
* success: function (res) {
|
|
187
|
+
* if (res.confirm) {
|
|
188
|
+
* console.log('用户点击确定')
|
|
189
|
+
* } else if (res.cancel) {
|
|
190
|
+
* console.log('用户点击取消')
|
|
191
|
+
* }
|
|
192
|
+
* }
|
|
193
|
+
* })
|
|
194
|
+
* ```
|
|
195
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showModal.html
|
|
196
|
+
*/
|
|
197
|
+
showModal(option?: showModal.Option): Promise<showModal.SuccessCallbackResult>
|
|
198
|
+
|
|
199
|
+
/** 显示 loading 提示框。需主动调用 Taro.hideLoading 才能关闭提示框
|
|
200
|
+
*
|
|
201
|
+
* **注意**
|
|
202
|
+
* - Taro.showLoading 和 Taro.showToast 同时只能显示一个
|
|
203
|
+
* - Taro.showLoading 应与 Taro.hideLoading 配对使用
|
|
204
|
+
* @supported weapp, h5, rn, tt, harmony_hybrid
|
|
205
|
+
* @example
|
|
206
|
+
* ```tsx
|
|
207
|
+
* Taro.showLoading({
|
|
208
|
+
* title: '加载中',
|
|
209
|
+
* })
|
|
210
|
+
* setTimeout(function () {
|
|
211
|
+
* Taro.hideLoading()
|
|
212
|
+
* }, 2000)
|
|
213
|
+
* ```
|
|
214
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html
|
|
215
|
+
*/
|
|
216
|
+
showLoading(option?: showLoading.Option): Promise<TaroGeneral.CallbackResult>
|
|
217
|
+
|
|
218
|
+
/** 显示操作菜单
|
|
219
|
+
*
|
|
220
|
+
* **注意**
|
|
221
|
+
* - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel";
|
|
222
|
+
* - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑
|
|
223
|
+
* @supported weapp, h5, rn, tt, harmony, harmony_hybrid
|
|
224
|
+
* @example
|
|
225
|
+
* ```tsx
|
|
226
|
+
* Taro.showActionSheet({
|
|
227
|
+
* itemList: ['A', 'B', 'C'],
|
|
228
|
+
* success: function (res) {
|
|
229
|
+
* console.log(res.tapIndex)
|
|
230
|
+
* },
|
|
231
|
+
* fail: function (res) {
|
|
232
|
+
* console.log(res.errMsg)
|
|
233
|
+
* }
|
|
234
|
+
* })
|
|
235
|
+
* ```
|
|
236
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showActionSheet.html
|
|
237
|
+
*/
|
|
238
|
+
showActionSheet(option: showActionSheet.Option): Promise<showActionSheet.SuccessCallbackResult>
|
|
239
|
+
|
|
240
|
+
/** 隐藏消息提示框
|
|
241
|
+
* @supported weapp, h5, rn, tt, harmony_hybrid
|
|
242
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideToast.html
|
|
243
|
+
*/
|
|
244
|
+
hideToast(option?: hideToast.Option): void
|
|
245
|
+
|
|
246
|
+
/** 隐藏 loading 提示框
|
|
247
|
+
* @supported weapp, h5, rn, tt, harmony_hybrid
|
|
248
|
+
* @example
|
|
249
|
+
* ```tsx
|
|
250
|
+
* Taro.showLoading({
|
|
251
|
+
* title: '加载中',
|
|
252
|
+
* })
|
|
253
|
+
* setTimeout(function (){
|
|
254
|
+
* Taro.hideLoading()
|
|
255
|
+
* },2000)
|
|
256
|
+
* ```
|
|
257
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideLoading.html
|
|
258
|
+
*/
|
|
259
|
+
hideLoading(option?: hideLoading.Option): void /** 隐藏 loading 提示框
|
|
260
|
+
|
|
261
|
+
/** 开启小程序页面返回询问对话框
|
|
262
|
+
* @supported weapp
|
|
263
|
+
* @example
|
|
264
|
+
* ```tsx
|
|
265
|
+
* Taro.enableAlertBeforeUnload({
|
|
266
|
+
* success: function () {
|
|
267
|
+
* console.log('success')
|
|
268
|
+
* },
|
|
269
|
+
* })
|
|
270
|
+
* ```
|
|
271
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.enableAlertBeforeUnload.html
|
|
272
|
+
*/
|
|
273
|
+
enableAlertBeforeUnload(option: enableAlertBeforeUnload.Option): void
|
|
274
|
+
|
|
275
|
+
/** 关闭小程序页面返回询问对话框
|
|
276
|
+
* @supported weapp
|
|
277
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.disableAlertBeforeUnload.html
|
|
278
|
+
*/
|
|
279
|
+
disableAlertBeforeUnload(option?: disableAlertBeforeUnload.Option): void
|
|
280
|
+
}
|
|
281
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace getMenuButtonBoundingClientRect {
|
|
5
|
+
/** 菜单按钮的布局位置信息 */
|
|
6
|
+
interface Rect {
|
|
7
|
+
/** 下边界坐标,单位:px */
|
|
8
|
+
bottom: number
|
|
9
|
+
/** 高度,单位:px */
|
|
10
|
+
height: number
|
|
11
|
+
/** 左边界坐标,单位:px */
|
|
12
|
+
left: number
|
|
13
|
+
/** 右边界坐标,单位:px */
|
|
14
|
+
right: number
|
|
15
|
+
/** 上边界坐标,单位:px */
|
|
16
|
+
top: number
|
|
17
|
+
/** 宽度,单位:px */
|
|
18
|
+
width: number
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface TaroStatic {
|
|
23
|
+
/** 获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
|
|
24
|
+
* @supported weapp, tt, harmony_hybrid
|
|
25
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/menu/wx.getMenuButtonBoundingClientRect.html
|
|
26
|
+
*/
|
|
27
|
+
getMenuButtonBoundingClientRect(): getMenuButtonBoundingClientRect.Rect
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace showNavigationBarLoading {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用成功的回调函数 */
|
|
11
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
namespace setNavigationBarTitle {
|
|
16
|
+
interface Option {
|
|
17
|
+
/** 页面标题 */
|
|
18
|
+
title: string
|
|
19
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
20
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
21
|
+
/** 接口调用失败的回调函数 */
|
|
22
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
23
|
+
/** 接口调用成功的回调函数 */
|
|
24
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
namespace setNavigationBarColor {
|
|
29
|
+
interface Option {
|
|
30
|
+
/** 背景颜色值,有效值为十六进制颜色 */
|
|
31
|
+
backgroundColor: string
|
|
32
|
+
/** 前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000 */
|
|
33
|
+
frontColor: string
|
|
34
|
+
/** 动画效果 */
|
|
35
|
+
animation?: AnimationOption
|
|
36
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
37
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
38
|
+
/** 接口调用失败的回调函数 */
|
|
39
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
40
|
+
/** 接口调用成功的回调函数 */
|
|
41
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
42
|
+
}
|
|
43
|
+
/** 动画效果 */
|
|
44
|
+
interface AnimationOption {
|
|
45
|
+
/** 动画变化时间,单位 ms */
|
|
46
|
+
duration?: number
|
|
47
|
+
/** 动画变化方式
|
|
48
|
+
*
|
|
49
|
+
* 可选值:
|
|
50
|
+
* - 'linear': 动画从头到尾的速度是相同的;
|
|
51
|
+
* - 'easeIn': 动画以低速开始;
|
|
52
|
+
* - 'easeOut': 动画以低速结束;
|
|
53
|
+
* - 'easeInOut': 动画以低速开始和结束; */
|
|
54
|
+
timingFunc?: 'linear' | 'easeIn' | 'easeOut' | 'easeInOut'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
namespace hideNavigationBarLoading {
|
|
59
|
+
interface Option {
|
|
60
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
61
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
62
|
+
/** 接口调用失败的回调函数 */
|
|
63
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
64
|
+
/** 接口调用成功的回调函数 */
|
|
65
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
namespace hideHomeButton {
|
|
70
|
+
interface Option {
|
|
71
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
72
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
73
|
+
/** 接口调用失败的回调函数 */
|
|
74
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
75
|
+
/** 接口调用成功的回调函数 */
|
|
76
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface TaroStatic {
|
|
81
|
+
/** 在当前页面显示导航条加载动画
|
|
82
|
+
* @supported weapp, rn, tt, harmony
|
|
83
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.showNavigationBarLoading.html
|
|
84
|
+
*/
|
|
85
|
+
showNavigationBarLoading(option?: showNavigationBarLoading.Option): void
|
|
86
|
+
|
|
87
|
+
/** 动态设置当前页面的标题
|
|
88
|
+
* @supported weapp, alipay, tt, h5, rn, harmony, harmony_hybrid
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsx
|
|
91
|
+
* Taro.setNavigationBarTitle({
|
|
92
|
+
* title: '当前页面'
|
|
93
|
+
* })
|
|
94
|
+
* ```
|
|
95
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarTitle.html
|
|
96
|
+
*/
|
|
97
|
+
setNavigationBarTitle(option: setNavigationBarTitle.Option): Promise<TaroGeneral.CallbackResult>
|
|
98
|
+
|
|
99
|
+
/** 设置页面导航条颜色
|
|
100
|
+
* @supported weapp, tt, h5, rn, harmony, harmony_hybrid
|
|
101
|
+
* @h5 不支持 animation 参数
|
|
102
|
+
* @rn 不支持 animation 参数
|
|
103
|
+
* @example
|
|
104
|
+
* ```tsx
|
|
105
|
+
* Taro.setNavigationBarColor({
|
|
106
|
+
* frontColor: '#ffffff',
|
|
107
|
+
* backgroundColor: '#ff0000',
|
|
108
|
+
* animation: {
|
|
109
|
+
* duration: 400,
|
|
110
|
+
* timingFunc: 'easeIn'
|
|
111
|
+
* }
|
|
112
|
+
* })
|
|
113
|
+
* ```
|
|
114
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarColor.html
|
|
115
|
+
*/
|
|
116
|
+
setNavigationBarColor(option: setNavigationBarColor.Option): Promise<TaroGeneral.CallbackResult>
|
|
117
|
+
|
|
118
|
+
/** 在当前页面隐藏导航条加载动画
|
|
119
|
+
* @supported weapp, rn, tt, harmony
|
|
120
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideNavigationBarLoading.html
|
|
121
|
+
*/
|
|
122
|
+
hideNavigationBarLoading(option?: hideNavigationBarLoading.Option): void
|
|
123
|
+
|
|
124
|
+
/** 隐藏返回首页按钮。微信7.0.7版本起,当用户打开的小程序最底层页面是非首页时,默认展示“返回首页”按钮,开发者可在页面 onShow 中调用 hideHomeButton 进行隐藏。
|
|
125
|
+
* @supported weapp, tt, harmony
|
|
126
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideHomeButton.html
|
|
127
|
+
*/
|
|
128
|
+
hideHomeButton(option?: hideHomeButton.Option): Promise<TaroGeneral.CallbackResult>
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace stopPullDownRefresh {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用成功的回调函数 */
|
|
11
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
namespace startPullDownRefresh {
|
|
16
|
+
interface Option {
|
|
17
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
18
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
19
|
+
/** 接口调用失败的回调函数 */
|
|
20
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
21
|
+
/** 接口调用成功的回调函数 */
|
|
22
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface TaroStatic {
|
|
27
|
+
/** 停止当前页面下拉刷新。
|
|
28
|
+
* @supported weapp, h5, rn, tt, harmony, harmony_hybrid
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* onPullDownRefresh: function (){
|
|
32
|
+
* Taro.stopPullDownRefresh()
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.stopPullDownRefresh.html
|
|
36
|
+
*/
|
|
37
|
+
stopPullDownRefresh(option?: stopPullDownRefresh.Option): void
|
|
38
|
+
|
|
39
|
+
/** 开始下拉刷新。调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。
|
|
40
|
+
* @supported weapp, h5, rn, tt, harmony, harmony_hybrid
|
|
41
|
+
* @rn 无动画效果
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* Taro.startPullDownRefresh()
|
|
45
|
+
* ```
|
|
46
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.startPullDownRefresh.html
|
|
47
|
+
*/
|
|
48
|
+
startPullDownRefresh(option?: startPullDownRefresh.Option): Promise<TaroGeneral.CallbackResult>
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace pageScrollTo {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
+
/** 滚动动画的时长,单位 ms */
|
|
9
|
+
duration?: number
|
|
10
|
+
/** 接口调用失败的回调函数 */
|
|
11
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
/** 滚动到页面的目标位置,单位 px */
|
|
13
|
+
scrollTop?: number
|
|
14
|
+
/** 选择器, css selector */
|
|
15
|
+
selector?: string
|
|
16
|
+
/** 偏移距离,需要和 selector 参数搭配使用,可以滚动到 selector 加偏移距离的位置,单位 px */
|
|
17
|
+
offsetTop?: number
|
|
18
|
+
/** 接口调用成功的回调函数 */
|
|
19
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** 增强 ScrollView 实例,可通过 [Taro.createSelectorQuery](/docs/apis/wxml/createSelectorQuery) 的 [NodesRef.node](/docs/apis/wxml/NodesRef#node) 方法获取。 仅在 `scroll-view` 组件开启 `enhanced` 属性后生效。
|
|
24
|
+
* @supported weapp
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* Taro.createSelectorQuery()
|
|
28
|
+
* .select('#scrollview')
|
|
29
|
+
* .node()
|
|
30
|
+
* .exec((res) => {
|
|
31
|
+
* const scrollView = res[0].node;
|
|
32
|
+
* scrollView.scrollEnabled = false;
|
|
33
|
+
* })
|
|
34
|
+
* ```
|
|
35
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.html
|
|
36
|
+
*/
|
|
37
|
+
interface ScrollViewContext {
|
|
38
|
+
/** 滚动开关 */
|
|
39
|
+
scrollEnabled: boolean
|
|
40
|
+
|
|
41
|
+
/** 设置滚动边界弹性 (仅在 iOS 下生效) */
|
|
42
|
+
bounces: boolean
|
|
43
|
+
|
|
44
|
+
/** 设置是否显示滚动条 */
|
|
45
|
+
showScrollbar: boolean
|
|
46
|
+
|
|
47
|
+
/** 分页滑动开关 */
|
|
48
|
+
pagingEnabled: boolean
|
|
49
|
+
|
|
50
|
+
/** 设置滚动减速速率 */
|
|
51
|
+
fastDeceleration: boolean
|
|
52
|
+
|
|
53
|
+
/** 取消滚动惯性 (仅在 iOS 下生效) */
|
|
54
|
+
decelerationDisabled: boolean
|
|
55
|
+
|
|
56
|
+
/** 滚动至指定位置
|
|
57
|
+
* @supported weapp, h5
|
|
58
|
+
* @h5 不支持 velocity 参数
|
|
59
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.scrollTo.html
|
|
60
|
+
*/
|
|
61
|
+
scrollTo(object: ScrollViewContext.scrollTo.Option): void
|
|
62
|
+
|
|
63
|
+
/** 滚动至指定位置
|
|
64
|
+
* @supported weapp, tt, h5
|
|
65
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.scrollIntoView.html
|
|
66
|
+
*/
|
|
67
|
+
scrollIntoView(
|
|
68
|
+
/** 元素选择器 */
|
|
69
|
+
selector: string
|
|
70
|
+
): void
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
namespace ScrollViewContext {
|
|
74
|
+
namespace scrollTo {
|
|
75
|
+
interface Option {
|
|
76
|
+
/** 顶部距离 */
|
|
77
|
+
top?: number
|
|
78
|
+
/** 左边界距离 */
|
|
79
|
+
left?: number
|
|
80
|
+
/** 初始速度 */
|
|
81
|
+
velocity?: number
|
|
82
|
+
/** 滚动动画时长 */
|
|
83
|
+
duration?: number
|
|
84
|
+
/** 是否启用滚动动画 */
|
|
85
|
+
animated?: boolean
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface TaroStatic {
|
|
91
|
+
/** 将页面滚动到目标位置,支持选择器和滚动距离两种方式定位
|
|
92
|
+
*
|
|
93
|
+
* **selector 语法**
|
|
94
|
+
* selector类似于 CSS 的选择器,但仅支持下列语法。
|
|
95
|
+
*
|
|
96
|
+
* - ID选择器:#the-id
|
|
97
|
+
* - class选择器(可以连续指定多个):.a-class.another-class
|
|
98
|
+
* - 子元素选择器:.the-parent > .the-child
|
|
99
|
+
* - 后代选择器:.the-ancestor .the-descendant
|
|
100
|
+
* - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
|
|
101
|
+
* - 多选择器的并集:#a-node, .some-other-nodes
|
|
102
|
+
* @supported weapp, h5, rn, tt, harmony, harmony_hybrid
|
|
103
|
+
* @example
|
|
104
|
+
* ```tsx
|
|
105
|
+
* Taro.pageScrollTo({
|
|
106
|
+
* scrollTop: 0,
|
|
107
|
+
* duration: 300
|
|
108
|
+
* })
|
|
109
|
+
* ```
|
|
110
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/wx.pageScrollTo.html
|
|
111
|
+
*/
|
|
112
|
+
pageScrollTo(option: pageScrollTo.Option): Promise<TaroGeneral.CallbackResult>
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace setTopBarText {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 置顶栏文字 */
|
|
7
|
+
text: string
|
|
8
|
+
/** 接口调用成功的回调函数 */
|
|
9
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用失败的回调函数 */
|
|
11
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
13
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
interface TaroStatic {
|
|
17
|
+
/** 动态设置置顶栏文字内容。只有当前小程序被置顶时能生效,如果当前小程序没有被置顶,也能调用成功,但是不会立即生效,只有在用户将这个小程序置顶后才换上设置的文字内容.
|
|
18
|
+
*
|
|
19
|
+
* **注意**
|
|
20
|
+
* - 调用成功后,需间隔 5s 才能再次调用此接口,如果在 5s 内再次调用此接口,会回调 fail,errMsg:"setTopBarText: fail invoke too frequently"
|
|
21
|
+
* @supported weapp
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* Taro.setTopBarText({
|
|
25
|
+
* text: 'hello, world!'
|
|
26
|
+
* })
|
|
27
|
+
* ```
|
|
28
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/sticky/wx.setTopBarText.html
|
|
29
|
+
*/
|
|
30
|
+
setTopBarText(option: setTopBarText.Option): Promise<TaroGeneral.CallbackResult>
|
|
31
|
+
}
|
|
32
|
+
}
|