@tarojs/taro 3.3.11 → 3.3.15
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/ad/index.d.ts +34 -28
- package/types/api/alipay/index.d.ts +11 -7
- package/types/api/base/debug.d.ts +60 -54
- package/types/api/base/env.d.ts +12 -8
- package/types/api/base/index.d.ts +87 -83
- package/types/api/base/system.d.ts +59 -54
- package/types/api/base/update.d.ts +37 -33
- package/types/api/base/weapp/app-event.d.ts +147 -131
- package/types/api/base/weapp/life-cycle.d.ts +14 -10
- package/types/api/canvas/index.d.ts +115 -110
- package/types/api/cloud/index.d.ts +99 -94
- package/types/api/data-analysis/index.d.ts +68 -64
- package/types/api/device/accelerometer.d.ts +57 -50
- package/types/api/device/battery.d.ts +19 -15
- package/types/api/device/ble.d.ts +241 -228
- package/types/api/device/bluetooth.d.ts +207 -194
- package/types/api/device/clipboard.d.ts +48 -43
- package/types/api/device/compass.d.ts +55 -48
- package/types/api/device/contact.d.ts +13 -9
- package/types/api/device/gyroscope.d.ts +41 -35
- package/types/api/device/iBeacon.d.ts +79 -73
- package/types/api/device/motion.d.ts +42 -37
- package/types/api/device/network.d.ts +80 -42
- package/types/api/device/nfc.d.ts +105 -96
- package/types/api/device/performance.d.ts +32 -18
- package/types/api/device/phone.d.ts +20 -15
- package/types/api/device/scan.d.ts +31 -26
- package/types/api/device/screen.d.ts +74 -67
- package/types/api/device/vibrate.d.ts +31 -25
- package/types/api/device/wifi.d.ts +151 -140
- package/types/api/ext/index.d.ts +44 -39
- package/types/api/files/index.d.ts +219 -209
- package/types/api/framework/index.d.ts +25 -20
- package/types/api/location/index.d.ts +140 -136
- package/types/api/media/audio.d.ts +135 -127
- package/types/api/media/background-audio.d.ts +135 -126
- package/types/api/media/camera.d.ts +30 -26
- package/types/api/media/editor.d.ts +35 -33
- package/types/api/media/image.d.ts +161 -150
- package/types/api/media/live.d.ts +88 -82
- package/types/api/media/map.d.ts +47 -43
- package/types/api/media/recorder.d.ts +90 -84
- package/types/api/media/video-processing.d.ts +10 -6
- package/types/api/media/video.d.ts +63 -58
- package/types/api/network/download.d.ts +34 -30
- package/types/api/network/mdns.d.ts +104 -91
- package/types/api/network/request.d.ts +83 -79
- package/types/api/network/udp.d.ts +20 -16
- package/types/api/network/upload.d.ts +60 -56
- package/types/api/network/websocket.d.ts +201 -194
- package/types/api/open-api/account.d.ts +18 -14
- package/types/api/open-api/address.d.ts +27 -23
- package/types/api/open-api/authorize.d.ts +30 -26
- package/types/api/open-api/card.d.ts +55 -51
- package/types/api/open-api/customer-service.d.ts +21 -17
- package/types/api/open-api/facial.d.ts +28 -24
- package/types/api/open-api/invoice.d.ts +38 -34
- package/types/api/open-api/login.d.ts +56 -52
- package/types/api/open-api/navigate.d.ts +79 -75
- package/types/api/open-api/payment.d.ts +34 -30
- package/types/api/open-api/settings.d.ts +49 -45
- package/types/api/open-api/soter.d.ts +92 -86
- package/types/api/open-api/subscribe-message.d.ts +24 -20
- package/types/api/open-api/user-info.d.ts +60 -57
- package/types/api/open-api/werun.d.ts +50 -46
- package/types/api/route/index.d.ts +122 -118
- package/types/api/share/index.d.ts +68 -64
- package/types/api/storage/background-fetch.d.ts +40 -35
- package/types/api/storage/index.d.ts +267 -262
- package/types/api/swan/index.d.ts +47 -42
- package/types/api/ui/animation.d.ts +21 -17
- package/types/api/ui/background.d.ts +38 -34
- package/types/api/ui/custom-component.d.ts +22 -18
- package/types/api/ui/fonts.d.ts +26 -21
- package/types/api/ui/interaction.d.ts +167 -121
- package/types/api/ui/keyboard.d.ts +59 -55
- package/types/api/ui/menu.d.ts +10 -6
- package/types/api/ui/navigation-bar.d.ts +67 -63
- package/types/api/ui/pull-down-refresh.d.ts +33 -29
- package/types/api/ui/scroll.d.ts +30 -26
- package/types/api/ui/sticky.d.ts +22 -19
- package/types/api/ui/tab-bar.d.ts +101 -97
- package/types/api/ui/window.d.ts +24 -18
- package/types/api/worker/index.d.ts +28 -24
- package/types/api/wxml/index.d.ts +42 -38
- package/types/global.d.ts +390 -0
- package/types/index.d.ts +12 -98
- package/types/taro.api.d.ts +94 -0
- package/types/taro.component.d.ts +10 -57
- package/types/taro.config.d.ts +24 -6
- package/types/taro.extend.d.ts +33 -75
- package/types/taro.hooks.d.ts +68 -67
- package/types/taro.lifecycle.d.ts +47 -28
- package/types/api/ad/index.ts +0 -6
- package/types/api/alipay/index.ts +0 -7
- package/types/api/index.d.ts +0 -352
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
/// <reference types="vue" />
|
|
3
|
-
/// <reference path="taro.lifecycle.d.ts" />
|
|
4
|
-
/// <reference path="taro.config.d.ts" />
|
|
5
3
|
|
|
6
|
-
|
|
4
|
+
import Taro, { ComponentOptions, Config, RouterInfo } from './index'
|
|
5
|
+
|
|
6
|
+
declare module './index' {
|
|
7
7
|
// Components
|
|
8
8
|
interface ComponentLifecycle<P, S, SS = any> extends NewLifecycle<P, S, SS> {
|
|
9
9
|
componentWillMount?(): void
|
|
@@ -60,53 +60,6 @@ declare namespace Taro {
|
|
|
60
60
|
$scope?: any
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
class Component<P, S> {
|
|
64
|
-
constructor(props?: Readonly<P>)
|
|
65
|
-
/**
|
|
66
|
-
* @deprecated
|
|
67
|
-
* @see https://reactjs.org/docs/legacy-context.html
|
|
68
|
-
*/
|
|
69
|
-
constructor(props?: P, context?: any)
|
|
70
|
-
|
|
71
|
-
config?: Config
|
|
72
|
-
|
|
73
|
-
options?: ComponentOptions
|
|
74
|
-
|
|
75
|
-
$componentType: 'PAGE' | 'COMPONENT'
|
|
76
|
-
|
|
77
|
-
$router: RouterInfo
|
|
78
|
-
|
|
79
|
-
$preloadData: any
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* 使用 `this.$preload` 函数进行页面跳转传参
|
|
83
|
-
* @example this.$preload('key', 'val');
|
|
84
|
-
* @example this.$preload({
|
|
85
|
-
x: 1,
|
|
86
|
-
y: 2
|
|
87
|
-
});
|
|
88
|
-
* @see https://nervjs.github.io/taro/docs/best-practice.html
|
|
89
|
-
*/
|
|
90
|
-
$preload(key: string, value: any): void
|
|
91
|
-
$preload(key: object): void
|
|
92
|
-
|
|
93
|
-
setState<K extends keyof S>(
|
|
94
|
-
state: ((prevState: Readonly<S>, props: P) => Pick<S, K> | S) | (Pick<S, K> | S),
|
|
95
|
-
callback?: () => any
|
|
96
|
-
): void
|
|
97
|
-
|
|
98
|
-
forceUpdate(callBack?: () => any): void
|
|
99
|
-
|
|
100
|
-
render(): React.ReactNode
|
|
101
|
-
|
|
102
|
-
readonly props: Readonly<P> & Readonly<{ children?: React.ReactNode }>
|
|
103
|
-
state: Readonly<S>
|
|
104
|
-
context: any
|
|
105
|
-
refs: {
|
|
106
|
-
[key: string]: any
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
63
|
type PropsWithChildren<P> = P & { children?: React.ReactNode }
|
|
111
64
|
|
|
112
65
|
interface FunctionComponent<P = {}> {
|
|
@@ -126,13 +79,6 @@ declare namespace Taro {
|
|
|
126
79
|
|
|
127
80
|
type SFC = StatelessFunctionComponent
|
|
128
81
|
|
|
129
|
-
class PureComponent<P = {}, S = {}> extends Component<P, S> {}
|
|
130
|
-
|
|
131
|
-
function memo<P = {}>(
|
|
132
|
-
FunctionComponent: FunctionComponent<P>,
|
|
133
|
-
compare?: (oldProps: P, newProps: P) => Boolean
|
|
134
|
-
): FunctionComponent<P>
|
|
135
|
-
|
|
136
82
|
interface Show {
|
|
137
83
|
componentDidShow?(options?: unknown): void
|
|
138
84
|
componentDidHide?(options?: unknown): void
|
|
@@ -208,4 +154,11 @@ declare namespace Taro {
|
|
|
208
154
|
**/
|
|
209
155
|
clearAnimation?(selector: string, options: ClearAnimationOptions, callback: () => void): void
|
|
210
156
|
}
|
|
157
|
+
|
|
158
|
+
interface TaroStatic {
|
|
159
|
+
memo<P = {}>(
|
|
160
|
+
FunctionComponent: FunctionComponent<P>,
|
|
161
|
+
compare?: (oldProps: P, newProps: P) => Boolean
|
|
162
|
+
): FunctionComponent<P>
|
|
163
|
+
}
|
|
211
164
|
}
|
package/types/taro.config.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import Taro from './index'
|
|
2
|
+
|
|
3
|
+
declare module './index' {
|
|
2
4
|
/**
|
|
3
5
|
* 微信小程序全局 Window 配置和页面配置的公共项目
|
|
4
6
|
*/
|
|
5
|
-
interface
|
|
7
|
+
interface CommonConfig {
|
|
6
8
|
/**
|
|
7
9
|
* 导航栏背景颜色,HexColor
|
|
8
10
|
* default: #000000
|
|
@@ -55,7 +57,7 @@ declare namespace Taro {
|
|
|
55
57
|
onReachBottomDistance?: number
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
interface PageConfig extends
|
|
60
|
+
interface PageConfig extends CommonConfig {
|
|
59
61
|
/**
|
|
60
62
|
* 设置为 true 则页面整体不能上下滚动;
|
|
61
63
|
* 只在页面配置中有效,无法在 app.json 中设置该项
|
|
@@ -85,7 +87,7 @@ declare namespace Taro {
|
|
|
85
87
|
enableShareTimeline?: boolean
|
|
86
88
|
}
|
|
87
89
|
|
|
88
|
-
interface WindowConfig extends
|
|
90
|
+
interface WindowConfig extends CommonConfig {
|
|
89
91
|
/**
|
|
90
92
|
* 屏幕旋转设置
|
|
91
93
|
* 支持 auto / portrait / landscape
|
|
@@ -106,7 +108,7 @@ declare namespace Taro {
|
|
|
106
108
|
allowsBounceVertical?: 'YES' | 'NO'
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
interface
|
|
111
|
+
interface TabBarItem {
|
|
110
112
|
/**
|
|
111
113
|
* 页面路径,必须在 pages 中先定义
|
|
112
114
|
*/
|
|
@@ -155,7 +157,7 @@ declare namespace Taro {
|
|
|
155
157
|
*/
|
|
156
158
|
custom?: boolean
|
|
157
159
|
|
|
158
|
-
list:
|
|
160
|
+
list: TabBarItem[]
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
interface NetworkTimeout {
|
|
@@ -339,4 +341,20 @@ declare namespace Taro {
|
|
|
339
341
|
cloud?: boolean
|
|
340
342
|
pageOrientation?: 'auto' | 'portrait' | 'landscape'
|
|
341
343
|
}
|
|
344
|
+
|
|
345
|
+
interface TaroStatic {
|
|
346
|
+
CommonConfig: CommonConfig
|
|
347
|
+
PageConfig: PageConfig
|
|
348
|
+
WindowConfig: WindowConfig
|
|
349
|
+
TarBarList: TabBarItem
|
|
350
|
+
TabBar: TabBar
|
|
351
|
+
NetworkTimeout: NetworkTimeout
|
|
352
|
+
SubPackage: SubPackage
|
|
353
|
+
Plugins: Plugins
|
|
354
|
+
PreloadRule: PreloadRule
|
|
355
|
+
Permission: Permission
|
|
356
|
+
AppConfig: AppConfig
|
|
357
|
+
Config: Config
|
|
358
|
+
}
|
|
342
359
|
}
|
|
360
|
+
|
package/types/taro.extend.d.ts
CHANGED
|
@@ -1,60 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference path="taro.component.d.ts" />
|
|
3
|
-
/// <reference path="api/network/request.d.ts" />
|
|
4
|
-
|
|
5
|
-
declare namespace Taro {
|
|
6
|
-
// Events
|
|
7
|
-
class Events {
|
|
8
|
-
/**
|
|
9
|
-
* 监听一个事件,接受参数
|
|
10
|
-
*/
|
|
11
|
-
on(eventName: string, listener: (...args: any[]) => void): this
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* 添加一个事件监听,并在事件触发完成之后移除Callbacks链
|
|
15
|
-
*/
|
|
16
|
-
once(eventName: string, listener: (...args: any[]) => void): this
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 取消监听一个事件
|
|
20
|
-
*/
|
|
21
|
-
off(eventName: string, listener?: (...args: any[]) => void): this
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* 取消监听的所有事件
|
|
25
|
-
*/
|
|
26
|
-
off(): this
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 触发一个事件,传参
|
|
30
|
-
*/
|
|
31
|
-
trigger(eventName: string, ...args: any[]): boolean
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// eventCenter
|
|
35
|
-
|
|
36
|
-
const eventCenter: Events
|
|
37
|
-
|
|
38
|
-
// ENV_TYPE
|
|
39
|
-
|
|
40
|
-
enum ENV_TYPE {
|
|
41
|
-
WEAPP = 'WEAPP',
|
|
42
|
-
WEB = 'WEB',
|
|
43
|
-
RN = 'RN',
|
|
44
|
-
SWAN = 'SWAN',
|
|
45
|
-
ALIPAY = 'ALIPAY',
|
|
46
|
-
TT = 'TT',
|
|
47
|
-
QQ = 'QQ',
|
|
48
|
-
JD = 'JD'
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function getEnv(): ENV_TYPE
|
|
52
|
-
|
|
53
|
-
function render(component: Component | JSX.Element, element: Element | null): any
|
|
54
|
-
|
|
55
|
-
function internal_safe_set(...arg: any[]): any
|
|
56
|
-
function internal_safe_get(...arg: any[]): any
|
|
1
|
+
import Taro, { Component } from './index'
|
|
57
2
|
|
|
3
|
+
declare module './index' {
|
|
58
4
|
type MessageType = 'info' | 'success' | 'error' | 'warning'
|
|
59
5
|
|
|
60
6
|
interface AtMessageOptions {
|
|
@@ -63,11 +9,6 @@ declare namespace Taro {
|
|
|
63
9
|
duration?: number
|
|
64
10
|
}
|
|
65
11
|
|
|
66
|
-
function atMessage(options: AtMessageOptions): void
|
|
67
|
-
|
|
68
|
-
function pxTransform(size: number, designWidth?: number): string
|
|
69
|
-
function initPxTransform(config: { designWidth: number; deviceRatio: object }): void
|
|
70
|
-
|
|
71
12
|
interface RequestParams extends request.Option<any> {
|
|
72
13
|
[propName: string]: any
|
|
73
14
|
}
|
|
@@ -81,21 +22,12 @@ declare namespace Taro {
|
|
|
81
22
|
proceed(requestParams: RequestParams): any
|
|
82
23
|
}
|
|
83
24
|
|
|
84
|
-
|
|
85
|
-
|
|
25
|
+
interface interceptors {
|
|
26
|
+
logInterceptor(chain: Chain): Promise<any>
|
|
86
27
|
|
|
87
|
-
|
|
28
|
+
timeoutInterceptor(chain: Chain): Promise<any>
|
|
88
29
|
}
|
|
89
30
|
|
|
90
|
-
function addInterceptor(interceptor: interceptor): any
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* 小程序引用插件 JS 接口
|
|
94
|
-
*/
|
|
95
|
-
function requirePlugin(pluginName: string): any
|
|
96
|
-
|
|
97
|
-
function setIsUsingDiff (flag: boolean)
|
|
98
|
-
|
|
99
31
|
interface Current {
|
|
100
32
|
app: AppInstance | null
|
|
101
33
|
router: RouterInfo | null
|
|
@@ -110,7 +42,33 @@ declare namespace Taro {
|
|
|
110
42
|
rnNavigationRef?: React.RefObject<any>
|
|
111
43
|
}
|
|
112
44
|
|
|
113
|
-
|
|
45
|
+
interface TaroStatic {
|
|
46
|
+
// eventCenter
|
|
47
|
+
eventCenter: TaroGeneral.Events
|
|
48
|
+
|
|
49
|
+
getEnv(): TaroGeneral.ENV_TYPE
|
|
50
|
+
|
|
51
|
+
render(component: Component | JSX.Element, element: Element | null): any
|
|
114
52
|
|
|
115
|
-
|
|
53
|
+
internal_safe_set(...arg: any[]): any
|
|
54
|
+
internal_safe_get(...arg: any[]): any
|
|
55
|
+
|
|
56
|
+
atMessage(options: AtMessageOptions): void
|
|
57
|
+
|
|
58
|
+
pxTransform(size: number, designWidth?: number): string
|
|
59
|
+
initPxTransform(config: { designWidth: number; deviceRatio: object }): void
|
|
60
|
+
|
|
61
|
+
addInterceptor(interceptor: interceptor): any
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 小程序引用插件 JS 接口
|
|
65
|
+
*/
|
|
66
|
+
requirePlugin(pluginName: string): any
|
|
67
|
+
|
|
68
|
+
setIsUsingDiff (flag: boolean)
|
|
69
|
+
|
|
70
|
+
Current: Current
|
|
71
|
+
|
|
72
|
+
getCurrentInstance(): Current
|
|
73
|
+
}
|
|
116
74
|
}
|
package/types/taro.hooks.d.ts
CHANGED
|
@@ -1,83 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference path="taro.component.d.ts" />
|
|
1
|
+
import Taro from './index'
|
|
3
2
|
|
|
4
|
-
declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
declare module './index' {
|
|
4
|
+
interface TaroStatic {
|
|
5
|
+
/**
|
|
6
|
+
* 页面展示时的回调。
|
|
7
|
+
*/
|
|
8
|
+
useDidShow(callback: () => any): void
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/**
|
|
11
|
+
* 页面隐藏时的回调。
|
|
12
|
+
*/
|
|
13
|
+
useDidHide(callback: () => any): void
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
/**
|
|
16
|
+
* 下拉刷新时的回调。
|
|
17
|
+
*/
|
|
18
|
+
usePullDownRefresh(callback: () => any): void
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
/**
|
|
21
|
+
* 上拉触底时的回调。
|
|
22
|
+
*/
|
|
23
|
+
useReachBottom(callback: () => any): void
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
/**
|
|
26
|
+
* 页面滚动时的回调。
|
|
27
|
+
*/
|
|
28
|
+
usePageScroll(callback: (payload: PageScrollObject) => any): void
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
/**
|
|
31
|
+
* 页面尺寸改变时的回调。
|
|
32
|
+
*/
|
|
33
|
+
useResize(callback: () => any): void
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
/**
|
|
36
|
+
* 页面转发时的回调。
|
|
37
|
+
*/
|
|
38
|
+
useShareAppMessage(callback: (payload: ShareAppMessageObject) => ShareAppMessageReturn): void
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
/**
|
|
41
|
+
* 当前是 tab 页时,tab 被点击时的回调。
|
|
42
|
+
*/
|
|
43
|
+
useTabItemTap(callback: (payload: TabItemTapObject) => any): void
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
/**
|
|
46
|
+
* 用户点击右上角菜单“收藏”按钮时的回调。
|
|
47
|
+
*/
|
|
48
|
+
useAddToFavorites(callback: (paload: AddToFavoritesObject) => AddToFavoritesReturnObject): void
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
/**
|
|
51
|
+
* 用户点击右上角菜单“分享到朋友圈”按钮时的回调。
|
|
52
|
+
*/
|
|
53
|
+
useShareTimeline(callback: () => ShareTimelineReturnObject): void
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
/**
|
|
56
|
+
* 页面初次渲染完成的回调。
|
|
57
|
+
* 此时页面已经准备妥当,可以和视图层进行交互。
|
|
58
|
+
*/
|
|
59
|
+
useReady(callback: () => any): void
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
/**
|
|
62
|
+
* 获取当前路由参数。
|
|
63
|
+
*/
|
|
64
|
+
useRouter<TParams extends Partial<Record<string, string>> = Partial<Record<string, string>>>(dynamic?: boolean): RouterInfo<TParams>
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
/**
|
|
67
|
+
* 导航栏的标题被点击时的回调。
|
|
68
|
+
* **仅支付宝小程序支持。**
|
|
69
|
+
*/
|
|
70
|
+
useTitleClick(callback: () => any): void
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
/**
|
|
73
|
+
* 导航栏的额外图标被点击时的回调。
|
|
74
|
+
* **仅支付宝小程序支持。**
|
|
75
|
+
*/
|
|
76
|
+
useOptionMenuClick(callback: () => any): void
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
/**
|
|
79
|
+
* 下拉中断时的回调。
|
|
80
|
+
* **仅支付宝小程序支持。**
|
|
81
|
+
*/
|
|
82
|
+
usePullIntercept(callback: () => any): void
|
|
83
|
+
}
|
|
83
84
|
}
|
|
@@ -1,4 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
import Taro from './index'
|
|
2
|
+
|
|
3
|
+
type TaroGetDerivedStateFromProps<P, S> =
|
|
4
|
+
/**
|
|
5
|
+
* Returns an update to a component's state based on its new props and old state.
|
|
6
|
+
*
|
|
7
|
+
* Note: its presence prevents any of the deprecated lifecycle methods from being invoked
|
|
8
|
+
*/
|
|
9
|
+
(nextProps: Readonly<P>, prevState: S) => Partial<S> | null;
|
|
10
|
+
|
|
11
|
+
interface TaroStaticLifecycle<P, S> {
|
|
12
|
+
getDerivedStateFromProps?: TaroGetDerivedStateFromProps<P, S>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface TaroNewLifecycle<P, S, SS> {
|
|
16
|
+
/**
|
|
17
|
+
* Runs before React applies the result of `render` to the document, and
|
|
18
|
+
* returns an object to be given to componentDidUpdate. Useful for saving
|
|
19
|
+
* things such as scroll position before `render` causes changes to it.
|
|
20
|
+
*
|
|
21
|
+
* Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated
|
|
22
|
+
* lifecycle events from running.
|
|
23
|
+
*/
|
|
24
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>): SS | null;
|
|
25
|
+
/**
|
|
26
|
+
* Called immediately after updating occurs. Not called for the initial render.
|
|
27
|
+
*
|
|
28
|
+
* The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
|
|
29
|
+
*/
|
|
30
|
+
componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot?: SS): void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare module './index' {
|
|
2
34
|
interface PageNotFoundObject {
|
|
3
35
|
/**
|
|
4
36
|
* 不存在页面的路径
|
|
@@ -8,7 +40,7 @@ declare namespace Taro {
|
|
|
8
40
|
/**
|
|
9
41
|
* 打开不存在页面的 query
|
|
10
42
|
*/
|
|
11
|
-
query:
|
|
43
|
+
query: Record<string, unknown>
|
|
12
44
|
|
|
13
45
|
/**
|
|
14
46
|
* 是否本次启动的首个页面(例如从分享等入口进来,首个页面是开发者配置的分享页面)
|
|
@@ -126,33 +158,20 @@ declare namespace Taro {
|
|
|
126
158
|
imageUrl?: string
|
|
127
159
|
}
|
|
128
160
|
|
|
129
|
-
type GetDerivedStateFromProps<P, S> =
|
|
130
|
-
/**
|
|
131
|
-
* Returns an update to a component's state based on its new props and old state.
|
|
132
|
-
*
|
|
133
|
-
* Note: its presence prevents any of the deprecated lifecycle methods from being invoked
|
|
134
|
-
*/
|
|
135
|
-
(nextProps: Readonly<P>, prevState: S) => Partial<S> | null;
|
|
161
|
+
type GetDerivedStateFromProps<P, S> = TaroGetDerivedStateFromProps<P, S>
|
|
136
162
|
|
|
137
|
-
|
|
138
|
-
getDerivedStateFromProps?: GetDerivedStateFromProps<P, S>;
|
|
139
|
-
}
|
|
163
|
+
type StaticLifecycle<P, S> = TaroStaticLifecycle<P, S>
|
|
140
164
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
* Called immediately after updating occurs. Not called for the initial render.
|
|
153
|
-
*
|
|
154
|
-
* The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
|
|
155
|
-
*/
|
|
156
|
-
componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot?: SS): void;
|
|
165
|
+
type NewLifecycle<P, S, SS> = TaroNewLifecycle<P, S, SS>
|
|
166
|
+
|
|
167
|
+
interface TaroStatic {
|
|
168
|
+
PageNotFoundObject: PageNotFoundObject
|
|
169
|
+
PageScrollObject: PageScrollObject
|
|
170
|
+
ShareAppMessageObject: ShareAppMessageObject
|
|
171
|
+
ShareAppMessageReturn: ShareAppMessageReturn
|
|
172
|
+
TabItemTapObject: TabItemTapObject
|
|
173
|
+
AddToFavoritesObject: AddToFavoritesObject
|
|
174
|
+
AddToFavoritesReturnObject: AddToFavoritesReturnObject
|
|
175
|
+
ShareTimelineReturnObject: ShareTimelineReturnObject
|
|
157
176
|
}
|
|
158
177
|
}
|
package/types/api/ad/index.ts
DELETED