@tarojs/taro 3.5.0-beta.2 → 3.5.0-beta.5
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 +7 -8
- package/types/api/base/weapp/app-event.d.ts +50 -11
- package/types/api/base/weapp/life-cycle.d.ts +6 -6
- package/types/api/canvas/index.d.ts +1 -1
- package/types/api/device/vibrate.d.ts +4 -0
- package/types/api/location/index.d.ts +36 -0
- package/types/compile.d.ts +14 -0
- package/types/global.d.ts +1 -1
- package/types/taro.component.d.ts +13 -24
- package/types/taro.config.d.ts +16 -0
- package/types/taro.hooks.d.ts +45 -3
- package/LICENSE +0 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro",
|
|
3
|
-
"version": "3.5.0-beta.
|
|
3
|
+
"version": "3.5.0-beta.5",
|
|
4
4
|
"description": "Taro framework",
|
|
5
5
|
"homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
|
|
6
6
|
"main": "index.js",
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
"html.css",
|
|
12
12
|
"html5.css"
|
|
13
13
|
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
16
|
-
},
|
|
17
14
|
"repository": {
|
|
18
15
|
"type": "git",
|
|
19
16
|
"url": "git+https://github.com/NervJS/taro.git"
|
|
@@ -24,8 +21,8 @@
|
|
|
24
21
|
"author": "O2Team",
|
|
25
22
|
"license": "MIT",
|
|
26
23
|
"dependencies": {
|
|
27
|
-
"@tarojs/api": "3.5.0-beta.
|
|
28
|
-
"@tarojs/runtime": "3.5.0-beta.
|
|
24
|
+
"@tarojs/api": "3.5.0-beta.5",
|
|
25
|
+
"@tarojs/runtime": "3.5.0-beta.5"
|
|
29
26
|
},
|
|
30
27
|
"peerDependenciesMeta": {
|
|
31
28
|
"@types/react": {
|
|
@@ -41,5 +38,7 @@
|
|
|
41
38
|
"optional": true
|
|
42
39
|
}
|
|
43
40
|
},
|
|
44
|
-
"
|
|
45
|
-
|
|
41
|
+
"scripts": {
|
|
42
|
+
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -28,19 +28,58 @@ declare module '../../../index' {
|
|
|
28
28
|
path: string
|
|
29
29
|
/** 小程序切前台的 query 参数 */
|
|
30
30
|
query: TaroGeneral.IAnyObject
|
|
31
|
-
/** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
|
|
32
|
-
referrerInfo: ResultReferrerInfo
|
|
33
|
-
/** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
|
|
34
|
-
scene: number
|
|
35
31
|
/** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
|
|
36
32
|
shareTicket: string
|
|
33
|
+
/** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
|
|
34
|
+
scene: number
|
|
35
|
+
/** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
|
|
36
|
+
referrerInfo: ResultReferrerInfo
|
|
37
|
+
/** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
|
|
38
|
+
forwardMaterials?: ForwardMaterial[]
|
|
39
|
+
/** 从微信群聊/单聊打开小程序时,chatType 表示具体微信群聊/单聊类型 */
|
|
40
|
+
chatType?: keyof ChatType
|
|
41
|
+
/** API 类别 */
|
|
42
|
+
apiCategory?: keyof ApiCategory
|
|
37
43
|
}
|
|
38
44
|
/** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
|
|
39
45
|
interface ResultReferrerInfo {
|
|
40
46
|
/** 来源小程序、公众号或 App 的 appId */
|
|
41
|
-
appId
|
|
47
|
+
appId?: string
|
|
42
48
|
/** 来源小程序传过来的数据,scene=1037或1038时支持 */
|
|
43
|
-
extraData
|
|
49
|
+
extraData?: TaroGeneral.IAnyObject
|
|
50
|
+
}
|
|
51
|
+
/** ChatType 类型合法值 */
|
|
52
|
+
interface ForwardMaterial {
|
|
53
|
+
/** 文件的mimetype类型 */
|
|
54
|
+
type: string
|
|
55
|
+
/** 文件名 */
|
|
56
|
+
name: string
|
|
57
|
+
/** 文件路径(如果是webview则是url) */
|
|
58
|
+
path: string
|
|
59
|
+
/** 文件大小 */
|
|
60
|
+
size: number
|
|
61
|
+
}
|
|
62
|
+
/** ChatType 类型合法值 */
|
|
63
|
+
interface ChatType {
|
|
64
|
+
/** 微信联系人单聊 */
|
|
65
|
+
1
|
|
66
|
+
/** 企业微信联系人单聊 */
|
|
67
|
+
2
|
|
68
|
+
/** 普通微信群聊 */
|
|
69
|
+
3
|
|
70
|
+
/** 企业微信互通群聊 */
|
|
71
|
+
4
|
|
72
|
+
}
|
|
73
|
+
/** API 类别合法值 */
|
|
74
|
+
interface ApiCategory {
|
|
75
|
+
/** 默认类别 */
|
|
76
|
+
default
|
|
77
|
+
/** 原生功能化,视频号直播商品、商品橱窗等场景打开的小程序 */
|
|
78
|
+
nativeFunctionalized
|
|
79
|
+
/** 仅浏览,朋友圈快照页等场景打开的小程序 */
|
|
80
|
+
browseOnly
|
|
81
|
+
/** 内嵌,通过打开半屏小程序能力打开的小程序 */
|
|
82
|
+
embedded
|
|
44
83
|
}
|
|
45
84
|
}
|
|
46
85
|
|
|
@@ -71,7 +110,7 @@ declare module '../../../index' {
|
|
|
71
110
|
|
|
72
111
|
interface TaroStatic {
|
|
73
112
|
/** 监听未处理的 Promise 拒绝事件。该事件与 [`App.onUnhandledRejection`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onUnhandledRejection-Object-object) 的回调时机与参数一致。
|
|
74
|
-
*
|
|
113
|
+
*
|
|
75
114
|
* **注意**
|
|
76
115
|
* - 所有的 unhandledRejection 都可以被这一监听捕获,但只有 Error 类型的才会在小程序后台触发报警。
|
|
77
116
|
* @supported weapp, tt
|
|
@@ -139,7 +178,7 @@ declare module '../../../index' {
|
|
|
139
178
|
* **注意**
|
|
140
179
|
*
|
|
141
180
|
* 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。
|
|
142
|
-
* @supported weapp, tt
|
|
181
|
+
* @supported weapp, h5, tt
|
|
143
182
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppShow.html
|
|
144
183
|
*/
|
|
145
184
|
onAppShow(
|
|
@@ -148,7 +187,7 @@ declare module '../../../index' {
|
|
|
148
187
|
): void
|
|
149
188
|
|
|
150
189
|
/** 监听小程序切后台事件。该事件与 [`App.onHide`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onhide) 的回调时机一致。
|
|
151
|
-
* @supported weapp, tt
|
|
190
|
+
* @supported weapp, h5, tt
|
|
152
191
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppHide.html
|
|
153
192
|
*/
|
|
154
193
|
onAppHide(
|
|
@@ -206,7 +245,7 @@ declare module '../../../index' {
|
|
|
206
245
|
): void
|
|
207
246
|
|
|
208
247
|
/** 取消监听小程序切前台事件
|
|
209
|
-
* @supported weapp, tt
|
|
248
|
+
* @supported weapp, h5, tt
|
|
210
249
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppShow.html
|
|
211
250
|
*/
|
|
212
251
|
offAppShow(
|
|
@@ -215,7 +254,7 @@ declare module '../../../index' {
|
|
|
215
254
|
): void
|
|
216
255
|
|
|
217
256
|
/** 取消监听小程序切后台事件
|
|
218
|
-
* @supported weapp, tt
|
|
257
|
+
* @supported weapp, h5, tt
|
|
219
258
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppHide.html
|
|
220
259
|
*/
|
|
221
260
|
offAppHide(
|
|
@@ -21,14 +21,14 @@ declare module '../../../index' {
|
|
|
21
21
|
/** API 类别 */
|
|
22
22
|
apiCategory?: keyof LaunchOptions.ApiCategory
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
namespace LaunchOptions {
|
|
26
26
|
/** 来源信息 */
|
|
27
27
|
interface ReferrerInfo {
|
|
28
28
|
/** 来源小程序、公众号或 App 的 appId */
|
|
29
|
-
appId
|
|
29
|
+
appId?: string
|
|
30
30
|
/** 来源小程序传过来的数据,scene=1037或1038时支持 */
|
|
31
|
-
extraData
|
|
31
|
+
extraData?: TaroGeneral.IAnyObject
|
|
32
32
|
}
|
|
33
33
|
/** ChatType 类型合法值 */
|
|
34
34
|
interface ForwardMaterial {
|
|
@@ -86,14 +86,14 @@ declare module '../../../index' {
|
|
|
86
86
|
/** API 类别 */
|
|
87
87
|
apiCategory?: keyof EnterOptions.ApiCategory
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
namespace EnterOptions {
|
|
91
91
|
/** 来源信息 */
|
|
92
92
|
interface ReferrerInfo {
|
|
93
93
|
/** 来源小程序、公众号或 App 的 appId */
|
|
94
|
-
appId
|
|
94
|
+
appId?: string
|
|
95
95
|
/** 来源小程序传过来的数据,scene=1037或1038时支持 */
|
|
96
|
-
extraData
|
|
96
|
+
extraData?: TaroGeneral.IAnyObject
|
|
97
97
|
}
|
|
98
98
|
/** ChatType 类型合法值 */
|
|
99
99
|
interface ForwardMaterial {
|
|
@@ -4,7 +4,7 @@ declare module '../../index' {
|
|
|
4
4
|
namespace canvasToTempFilePath {
|
|
5
5
|
interface Option {
|
|
6
6
|
/** 画布标识,传入 [canvas](/docs/components/canvas) 组件实例 (canvas type="2d" 时使用该属性)。 */
|
|
7
|
-
canvas?:
|
|
7
|
+
canvas?: Canvas
|
|
8
8
|
/** 画布标识,传入 [canvas](/docs/components/canvas) 组件的 canvas-id */
|
|
9
9
|
canvasId?: string
|
|
10
10
|
/** 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。 */
|
|
@@ -3,6 +3,8 @@ import Taro from '../../index'
|
|
|
3
3
|
declare module '../../index' {
|
|
4
4
|
namespace vibrateShort {
|
|
5
5
|
interface Option {
|
|
6
|
+
/** 震动强度类型,有效值为:heavy、medium、light */
|
|
7
|
+
type: 'heavy' | 'medium' | 'light'
|
|
6
8
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
9
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
10
|
/** 接口调用失败的回调函数 */
|
|
@@ -25,6 +27,8 @@ declare module '../../index' {
|
|
|
25
27
|
|
|
26
28
|
interface TaroStatic {
|
|
27
29
|
/** 使手机发生较短时间的振动(15 ms)。仅在 iPhone `7 / 7 Plus` 以上及 Android 机型生效
|
|
30
|
+
* @h5 不支持 type 参数
|
|
31
|
+
* @rn 不支持 type 参数
|
|
28
32
|
* @supported weapp, h5, rn, tt
|
|
29
33
|
* @example
|
|
30
34
|
* ```tsx
|
|
@@ -188,6 +188,26 @@ declare module '../../index' {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
+
namespace getFuzzyLocation {
|
|
192
|
+
interface Option {
|
|
193
|
+
/** wgs84 返回 gps 坐标,gcj02 返回可用于 Taro.openLocation 的坐标 */
|
|
194
|
+
type?: 'wgs84' | 'gcj02'
|
|
195
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
196
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
197
|
+
/** 接口调用失败的回调函数 */
|
|
198
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
199
|
+
/** 接口调用成功的回调函数 */
|
|
200
|
+
success?: (result: SuccessCallbackResult) => void
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
204
|
+
/** 纬度,范围为 -90~90,负数表示南纬 */
|
|
205
|
+
latitude: string
|
|
206
|
+
/** 经度,范围为 -180~180,负数表示西经 */
|
|
207
|
+
longitude: string
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
191
211
|
interface TaroStatic {
|
|
192
212
|
/** 关闭监听实时位置变化,前后台都停止消息接收
|
|
193
213
|
* @supported weapp, rn, tt
|
|
@@ -329,5 +349,21 @@ declare module '../../index' {
|
|
|
329
349
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html
|
|
330
350
|
*/
|
|
331
351
|
chooseLocation(option: chooseLocation.Option): Promise<chooseLocation.SuccessCallbackResult>
|
|
352
|
+
|
|
353
|
+
/** 获取当前的模糊地理位置
|
|
354
|
+
* @supported weapp
|
|
355
|
+
* @example
|
|
356
|
+
* ```tsx
|
|
357
|
+
* Taro.getFuzzyLocation({
|
|
358
|
+
* type: 'wgs84',
|
|
359
|
+
* success (res) {
|
|
360
|
+
* const latitude = res.latitude
|
|
361
|
+
* const longitude = res.longitude
|
|
362
|
+
* },
|
|
363
|
+
* })
|
|
364
|
+
* ```
|
|
365
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getFuzzyLocation.html
|
|
366
|
+
*/
|
|
367
|
+
getFuzzyLocation(option: getFuzzyLocation.Option): Promise<getFuzzyLocation.SuccessCallbackResult>
|
|
332
368
|
}
|
|
333
369
|
}
|
package/types/compile.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import swc from '@swc/core'
|
|
1
2
|
export { Current } from '@tarojs/runtime'
|
|
2
3
|
import webpack from 'webpack'
|
|
3
4
|
import webpackDevServer from 'webpack-dev-server'
|
|
5
|
+
import HtmlWebpackPlugin from 'html-webpack-plugin'
|
|
4
6
|
|
|
5
7
|
export const enum TEMPLATE_TYPES {
|
|
6
8
|
WEAPP = '.wxml',
|
|
@@ -195,6 +197,7 @@ export interface IH5Config {
|
|
|
195
197
|
useHtmlComponents?: boolean
|
|
196
198
|
|
|
197
199
|
postcss?: IPostcssOption
|
|
200
|
+
htmlPluginOption?: HtmlWebpackPlugin.Options
|
|
198
201
|
}
|
|
199
202
|
|
|
200
203
|
type FeatureItem = {
|
|
@@ -368,6 +371,7 @@ interface IPrebundle {
|
|
|
368
371
|
include?: string[]
|
|
369
372
|
exclude?: string[]
|
|
370
373
|
esbuild?: Record<string, any>
|
|
374
|
+
swc?: swc.Config
|
|
371
375
|
webpack?: {
|
|
372
376
|
provide?: any[]
|
|
373
377
|
}
|
|
@@ -384,6 +388,8 @@ interface ILogger {
|
|
|
384
388
|
}
|
|
385
389
|
|
|
386
390
|
export interface IProjectBaseConfig {
|
|
391
|
+
isWatch?: boolean
|
|
392
|
+
port?: number
|
|
387
393
|
projectName?: string
|
|
388
394
|
date?: string
|
|
389
395
|
designWidth?: number
|
|
@@ -406,9 +412,17 @@ export interface IProjectBaseConfig {
|
|
|
406
412
|
presets?: PluginItem[]
|
|
407
413
|
baseLevel?: number
|
|
408
414
|
framework?: string
|
|
415
|
+
frameworkExts?: string[]
|
|
409
416
|
compiler?: Compiler
|
|
410
417
|
cache?: ICache
|
|
411
418
|
logger?: ILogger
|
|
419
|
+
enableSourceMap?: boolean
|
|
420
|
+
/** hooks */
|
|
421
|
+
modifyWebpackChain?: HookModifyWebpackChain
|
|
422
|
+
modifyMiniConfigs?: (configMap) => Promise<any>
|
|
423
|
+
modifyBuildAssets?: (assets, plugin?) => Promise<any>
|
|
424
|
+
onWebpackChainReady?: (webpackChain: Chain) => Promise<any>
|
|
425
|
+
onBuildFinish?: (res: { error, stats, isWatch }) => Promise<any>
|
|
412
426
|
}
|
|
413
427
|
|
|
414
428
|
export interface IProjectConfig extends IProjectBaseConfig {
|
package/types/global.d.ts
CHANGED
|
@@ -15,13 +15,7 @@ declare module './index' {
|
|
|
15
15
|
componentDidShow?(): void
|
|
16
16
|
componentDidHide?(): void
|
|
17
17
|
componentDidCatchError?(err: string): void
|
|
18
|
-
componentDidNotFound?(
|
|
19
|
-
onPullDownRefresh?(): void
|
|
20
|
-
onReachBottom?(): void
|
|
21
|
-
onPageScroll?(obj: PageScrollObject): void
|
|
22
|
-
onShareAppMessage?(obj: ShareAppMessageObject): ShareAppMessageReturn
|
|
23
|
-
onTabItemTap?(obj: TabItemTapObject): void
|
|
24
|
-
onResize?(obj: PageResizeObject): void
|
|
18
|
+
componentDidNotFound?(opt: PageNotFoundObject): void
|
|
25
19
|
}
|
|
26
20
|
interface ComponentOptions {
|
|
27
21
|
addGlobalClass?: boolean
|
|
@@ -47,6 +41,7 @@ declare module './index' {
|
|
|
47
41
|
|
|
48
42
|
shareTicket: string | undefined
|
|
49
43
|
scene: number | undefined
|
|
44
|
+
exitState?: any
|
|
50
45
|
}
|
|
51
46
|
interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {
|
|
52
47
|
$scope?: any
|
|
@@ -73,10 +68,10 @@ declare module './index' {
|
|
|
73
68
|
onHide?(): void
|
|
74
69
|
}
|
|
75
70
|
interface AppInstance extends Show {
|
|
76
|
-
mount(component: React.Component | Vue.ComponentOptions<Vue>, id: string, cb: () => void): void
|
|
71
|
+
mount(component: React.Component | Vue.ComponentOptions<Vue>, id: string, cb: (...args: any[]) => void): void
|
|
77
72
|
componentDidShow?(options?: Record<string, unknown>): void
|
|
78
73
|
onShow?(options?: Record<string, unknown>): void
|
|
79
|
-
unmount(id: string, cb
|
|
74
|
+
unmount(id: string, cb?: () => void): void
|
|
80
75
|
}
|
|
81
76
|
type Target = Record<string, unknown> & { dataset: Record<string, unknown>; id: string }
|
|
82
77
|
interface MpEvent {
|
|
@@ -86,18 +81,18 @@ declare module './index' {
|
|
|
86
81
|
currentTarget: Target
|
|
87
82
|
}
|
|
88
83
|
interface PageLifeCycle extends Show {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
onPageScroll?(obj: { scrollTop: number }): void
|
|
92
|
-
onShareAppMessage?(obj: { from: string; target?: any; webViewUrl: string }): void
|
|
93
|
-
onResize?(options: unknown): void
|
|
94
|
-
onTabItemTap?(obj: { index: string; pagePath: string; text: string }): void
|
|
95
|
-
onTitleClick?(): void
|
|
84
|
+
eh?(event: MpEvent): void
|
|
85
|
+
onLoad(options: Record<string, unknown>): void
|
|
96
86
|
onOptionMenuClick?(): void
|
|
87
|
+
onPageScroll?(opt: PageScrollObject): void
|
|
97
88
|
onPopMenuClick?(): void
|
|
89
|
+
onPullDownRefresh?(): void
|
|
98
90
|
onPullIntercept?(): void
|
|
99
|
-
|
|
100
|
-
|
|
91
|
+
onReachBottom?(): void
|
|
92
|
+
onResize?(opt: PageResizeObject): void
|
|
93
|
+
onShareAppMessage?(opt: ShareAppMessageObject): ShareAppMessageReturn
|
|
94
|
+
onTabItemTap?(opt: TabItemTapObject): void
|
|
95
|
+
onTitleClick?(): void
|
|
101
96
|
onUnload(): void
|
|
102
97
|
}
|
|
103
98
|
interface ComponentInstance<
|
|
@@ -184,10 +179,4 @@ declare module './index' {
|
|
|
184
179
|
/** 页面的组件选项 */
|
|
185
180
|
options?: Record<string, unknown>
|
|
186
181
|
}
|
|
187
|
-
interface TaroStatic {
|
|
188
|
-
memo<P = {}>(
|
|
189
|
-
FunctionComponent: FunctionComponent<P>,
|
|
190
|
-
compare?: (oldProps: P, newProps: P) => boolean
|
|
191
|
-
): FunctionComponent<P>
|
|
192
|
-
}
|
|
193
182
|
}
|
package/types/taro.config.d.ts
CHANGED
|
@@ -359,6 +359,22 @@ declare module './index' {
|
|
|
359
359
|
/** 视频号直播打开的第一个页面的全屏状态使用自定义顶部,支持 */
|
|
360
360
|
firstPageNavigationStyle?: 'default' | 'custom'
|
|
361
361
|
}
|
|
362
|
+
/** 小程序调试相关配置项 */
|
|
363
|
+
debugOptions?: {
|
|
364
|
+
/** 是否开启 FPS 面板,默认false */
|
|
365
|
+
enableFPSPanel?: boolean
|
|
366
|
+
}
|
|
367
|
+
/** touch 事件监听是否为 passive,默认false */
|
|
368
|
+
enablePassiveEvent?: boolean | {
|
|
369
|
+
/** 是否设置 touchstart 事件为 passive,默认false */
|
|
370
|
+
touchstart?: boolean
|
|
371
|
+
/** 是否设置 touchmove 事件为 passive,默认false */
|
|
372
|
+
touchmove?: boolean
|
|
373
|
+
/** 是否设置 wheel 事件为 passive,默认false */
|
|
374
|
+
wheel?: boolean
|
|
375
|
+
}
|
|
376
|
+
/** 自定义模块映射规则 */
|
|
377
|
+
resolveAlias?: Record<string, string>
|
|
362
378
|
/** 接受一个数组,每一项都是字符串,来指定编译为原生小程序组件的组件入口 */
|
|
363
379
|
components?: string[]
|
|
364
380
|
/** 渲染页面的容器 id
|
package/types/taro.hooks.d.ts
CHANGED
|
@@ -4,90 +4,132 @@ declare module './index' {
|
|
|
4
4
|
interface TaroStatic {
|
|
5
5
|
/**
|
|
6
6
|
* 页面展示时的回调。
|
|
7
|
+
* @supported global
|
|
7
8
|
*/
|
|
8
9
|
useDidShow(callback: () => void): void
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* 页面隐藏时的回调。
|
|
13
|
+
* @supported global
|
|
12
14
|
*/
|
|
13
15
|
useDidHide(callback: () => void): void
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* 下拉刷新时的回调。
|
|
19
|
+
* @supported global
|
|
17
20
|
*/
|
|
18
21
|
usePullDownRefresh(callback: () => void): void
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* 上拉触底时的回调。
|
|
25
|
+
* @supported global
|
|
22
26
|
*/
|
|
23
27
|
useReachBottom(callback: () => void): void
|
|
24
28
|
|
|
25
29
|
/**
|
|
26
30
|
* 页面滚动时的回调。
|
|
31
|
+
* @supported global
|
|
27
32
|
*/
|
|
28
33
|
usePageScroll(callback: (payload: PageScrollObject) => void): void
|
|
29
34
|
|
|
30
35
|
/**
|
|
31
36
|
* 页面尺寸改变时的回调。
|
|
37
|
+
* @supported global
|
|
32
38
|
*/
|
|
33
39
|
useResize(callback: (payload: PageResizeObject) => void): void
|
|
34
40
|
|
|
35
41
|
/**
|
|
36
42
|
* 页面转发时的回调。
|
|
43
|
+
* @supported weapp
|
|
37
44
|
*/
|
|
38
45
|
useShareAppMessage(callback: (payload: ShareAppMessageObject) => ShareAppMessageReturn): void
|
|
39
46
|
|
|
40
47
|
/**
|
|
41
48
|
* 当前是 tab 页时,tab 被点击时的回调。
|
|
49
|
+
* @supported weapp, rn
|
|
42
50
|
*/
|
|
43
51
|
useTabItemTap(callback: (payload: TabItemTapObject) => void): void
|
|
44
52
|
|
|
45
53
|
/**
|
|
46
54
|
* 用户点击右上角菜单“收藏”按钮时的回调。
|
|
55
|
+
* @supported weapp
|
|
47
56
|
*/
|
|
48
57
|
useAddToFavorites(callback: (payload: AddToFavoritesObject) => AddToFavoritesReturnObject): void
|
|
49
58
|
|
|
50
59
|
/**
|
|
51
60
|
* 用户点击右上角菜单“分享到朋友圈”按钮时的回调。
|
|
61
|
+
* @supported weapp
|
|
52
62
|
*/
|
|
53
63
|
useShareTimeline(callback: () => ShareTimelineReturnObject): void
|
|
54
64
|
|
|
65
|
+
/**
|
|
66
|
+
* 页面销毁前保留状态回调
|
|
67
|
+
* @supported weapp
|
|
68
|
+
*/
|
|
69
|
+
useSaveExitState(callback: () => {
|
|
70
|
+
data: Record<any, any>
|
|
71
|
+
expireTimeStamp?: number
|
|
72
|
+
}): void
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 小程序初始化完成时的回调。
|
|
76
|
+
* @supported weapp, h5
|
|
77
|
+
*/
|
|
78
|
+
useLaunch(callback: (options: getLaunchOptionsSync.LaunchOptions) => void): void
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 小程序发生脚本错误或 API 调用报错时触发的回调。
|
|
82
|
+
* @supported weapp, h5
|
|
83
|
+
*/
|
|
84
|
+
useError(callback: (error: string) => void): void
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 小程序要打开的页面不存在时触发的回调。
|
|
88
|
+
* @supported weapp, h5
|
|
89
|
+
* @h5 多页面模式不支持该方法
|
|
90
|
+
*/
|
|
91
|
+
usePageNotFound(callback: (res: { path: string, query: Record<any, any>, isEntryPage: boolean, [key: string]: any }) => void): void
|
|
92
|
+
|
|
55
93
|
/**
|
|
56
94
|
* 页面加载完成时的回调。
|
|
95
|
+
* @supported weapp, h5
|
|
57
96
|
*/
|
|
58
97
|
useLoad(callback: () => void): void
|
|
59
98
|
|
|
60
99
|
/**
|
|
61
100
|
* 页面卸载时的回调。
|
|
101
|
+
* @supported weapp, h5
|
|
62
102
|
*/
|
|
63
103
|
useUnload(callback: () => void): void
|
|
64
104
|
|
|
65
105
|
/**
|
|
66
106
|
* 页面初次渲染完成的回调。
|
|
67
107
|
* 此时页面已经准备妥当,可以和视图层进行交互。
|
|
108
|
+
* @supported weapp, h5
|
|
68
109
|
*/
|
|
69
110
|
useReady(callback: () => void): void
|
|
70
111
|
|
|
71
112
|
/**
|
|
72
113
|
* 获取当前路由参数。
|
|
114
|
+
* @supported global
|
|
73
115
|
*/
|
|
74
116
|
useRouter<TParams extends Partial<Record<string, string>> = Partial<Record<string, string>>>(dynamic?: boolean): RouterInfo<TParams>
|
|
75
117
|
|
|
76
118
|
/**
|
|
77
119
|
* 导航栏的标题被点击时的回调。
|
|
78
|
-
*
|
|
120
|
+
* @supported alipay
|
|
79
121
|
*/
|
|
80
122
|
useTitleClick(callback: () => void): void
|
|
81
123
|
|
|
82
124
|
/**
|
|
83
125
|
* 导航栏的额外图标被点击时的回调。
|
|
84
|
-
*
|
|
126
|
+
* @supported alipay
|
|
85
127
|
*/
|
|
86
128
|
useOptionMenuClick(callback: () => void): void
|
|
87
129
|
|
|
88
130
|
/**
|
|
89
131
|
* 下拉中断时的回调。
|
|
90
|
-
*
|
|
132
|
+
* @supported alipay, h5
|
|
91
133
|
*/
|
|
92
134
|
usePullIntercept(callback: () => void): void
|
|
93
135
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|