@dcloudio/uni-app-x 0.1.2 → 0.3.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.
Files changed (59) hide show
  1. package/.env +1 -0
  2. package/index.d.ts +1 -2
  3. package/package.json +12 -2
  4. package/types/index.d.ts +4 -0
  5. package/{native → types/native}/CustomEvent.d.ts +6 -0
  6. package/types/native/DrawableContext.d.ts +46 -0
  7. package/{native → types/native}/IPageManager.d.ts +3 -0
  8. package/types/native/RefresherEvent.d.ts +10 -0
  9. package/{native → types/native}/ResizeEvent.d.ts +2 -0
  10. package/types/native/ScrollEvent.d.ts +15 -0
  11. package/types/native/ScrollToLowerEvent.d.ts +10 -0
  12. package/types/native/ScrollToUpperEvent.d.ts +10 -0
  13. package/{native → types/native}/index.d.ts +4 -1
  14. package/types/uni/base/index.d.ts +3 -0
  15. package/types/uni/core/index.d.ts +9 -0
  16. package/types/uni/core/lib/base/event/index.d.ts +15 -0
  17. package/types/uni/core/lib/base/event/interface.d.ts +40 -0
  18. package/types/uni/core/lib/interface.d.ts +16 -0
  19. package/types/uni/core/lib/lifecycle/index.d.ts +9 -0
  20. package/types/uni/core/lib/lifecycle/interface.d.ts +12 -0
  21. package/types/uni/core/lib/route/index.d.ts +65 -0
  22. package/types/uni/core/lib/route/interface.d.ts +208 -0
  23. package/types/uni/core/lib/ui/create-selector-query/index.d.ts +15 -0
  24. package/types/uni/core/lib/ui/create-selector-query/interface.d.ts +172 -0
  25. package/types/uni/core/lib/ui/load-font-face/index.d.ts +25 -0
  26. package/types/uni/core/lib/ui/load-font-face/interface.d.ts +59 -0
  27. package/types/uni/core/lib/ui/page-scroll-to/index.d.ts +23 -0
  28. package/types/uni/core/lib/ui/page-scroll-to/interface.d.ts +52 -0
  29. package/types/uni/core/lib/ui/pull-down-refresh/index.d.ts +25 -0
  30. package/types/uni/core/lib/ui/pull-down-refresh/interface.d.ts +52 -0
  31. package/types/uni/core/lib/ui/set-navigation-bar-color/index.d.ts +23 -0
  32. package/types/uni/core/lib/ui/set-navigation-bar-color/interface.d.ts +56 -0
  33. package/types/uni/core/lib/ui/tab-bar/index.d.ts +145 -0
  34. package/types/uni/core/lib/ui/tab-bar/interface.d.ts +442 -0
  35. package/types/uni/ext/index.d.ts +0 -0
  36. package/types/uni/index.d.ts +3 -0
  37. package/types/uni-cloud/index.d.ts +274 -0
  38. package/types/vue/CheckboxGroupChangeEvent.d.ts +16 -0
  39. package/types/vue/PickerViewChangeEvent.d.ts +16 -0
  40. package/types/vue/ProgressActiveendEvent.d.ts +16 -0
  41. package/types/vue/RadioGroupChangeEvent.d.ts +16 -0
  42. package/types/vue/SliderChangeEvent.d.ts +16 -0
  43. package/types/vue/SwitchChangeEvent.d.ts +16 -0
  44. package/types/vue/index.d.ts +6 -0
  45. package/vue/CheckboxGroupChangeEvent.d.ts +0 -10
  46. package/vue/index.d.ts +0 -1
  47. /package/{native → types/native}/Event.d.ts +0 -0
  48. /package/{native → types/native}/IApp.d.ts +0 -0
  49. /package/{native → types/native}/IDocument.d.ts +0 -0
  50. /package/{native → types/native}/INode.d.ts +0 -0
  51. /package/{native → types/native}/IPage.d.ts +0 -0
  52. /package/{native → types/native}/ITabsNode.d.ts +0 -0
  53. /package/{native → types/native}/MouseEvent.d.ts +0 -0
  54. /package/{native → types/native}/NodeData.d.ts +0 -0
  55. /package/{native → types/native}/PageEvent.d.ts +0 -0
  56. /package/{native → types/native}/PageScrollEvent.d.ts +0 -0
  57. /package/{native → types/native}/TabTapEvent.d.ts +0 -0
  58. /package/{native → types/native}/TouchEvent.d.ts +0 -0
  59. /package/{native → types/native}/UniAppManager.d.ts +0 -0
package/.env ADDED
@@ -0,0 +1 @@
1
+ UNI_CORE_DIR = "/Users/guoshengqiang/Documents/vuejs-core/packages/runtime-uts/src/extapi"
package/index.d.ts CHANGED
@@ -1,2 +1 @@
1
- /// <reference path='./native/index.d.ts' />
2
- /// <reference path='./vue/index.d.ts' />
1
+ /// <reference path='./types/index.d.ts' />
package/package.json CHANGED
@@ -1,8 +1,18 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-app-x",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "description": "uni-app x types",
5
5
  "typings": "index.d.ts",
6
6
  "author": "DCloud",
7
- "license": "Apache-2.0"
7
+ "license": "Apache-2.0",
8
+ "type": "module",
9
+ "scripts": {
10
+ "build:types": "node ./scripts/build-types.js"
11
+ },
12
+ "devDependencies": {
13
+ "delete": "^1.1.0",
14
+ "dotenv": "^16.3.1",
15
+ "fs-extra": "^11.1.1",
16
+ "glob": "^10.3.3"
17
+ }
8
18
  }
@@ -0,0 +1,4 @@
1
+ /// <reference path='./native/index.d.ts' />
2
+ /// <reference path='./vue/index.d.ts' />
3
+ /// <reference path='./uni/index.d.ts' />
4
+ /// <reference path='./uni-cloud/index.d.ts' />
@@ -1,10 +1,16 @@
1
1
  /// <reference path="./Event.d.ts" />
2
2
 
3
+ /**
4
+ * @package io.dcloud.uniapp.runtime
5
+ */
3
6
  declare class CustomEventOptions<T>{
4
7
  detail: T
5
8
  constructor (detail: T)
6
9
  }
7
10
 
11
+ /**
12
+ * @package io.dcloud.uniapp.runtime
13
+ */
8
14
  declare class CustomEvent<T> extends Event {
9
15
  constructor (type: string, options: CustomEventOptions<T>)
10
16
  }
@@ -0,0 +1,46 @@
1
+ /// <reference path='./INode.d.ts' />
2
+
3
+ /**
4
+ * @package io.dcloud.uniapp.runtime
5
+ */
6
+
7
+ declare class DrawableContext {
8
+ font : string
9
+ fillStyle : string
10
+ lineCap : string
11
+ lineDashOffset : number
12
+ lineJoin : string
13
+ lineWidth : number
14
+ strokeStyle : string
15
+ textAlign : string
16
+
17
+ beginPath() : void
18
+
19
+ arc(x : number, y : number, radius : number, startAngle : number, endAngle : number, anticlockwise ?: boolean) : void
20
+
21
+ moveTo(x : number, y : number) : void
22
+
23
+ rect(x : number, y : number, width : number, height : number) : void
24
+
25
+ lineTo(x : number, y : number) : void
26
+
27
+ closePath() : void
28
+
29
+ stroke() : void
30
+
31
+ strokeRect(x : number, y : number, width : number, height : number) : void
32
+
33
+ strokeText(text : string, x : number, y : number) : void
34
+
35
+ fill(fillRule ?: string) : void
36
+
37
+ fillRect(x : number, y : number, width : number, height : number) : void
38
+
39
+ fillText(text : string, x : number, y : number) : void
40
+
41
+ reset() : void
42
+
43
+ update() : void
44
+
45
+ setLineDash(segments : Array<number>) : void
46
+ }
@@ -1,5 +1,8 @@
1
1
  /// <reference path='./IPage.d.ts' />
2
2
 
3
+ /**
4
+ * @package io.dcloud.uniapp.runtime
5
+ */
3
6
  declare class IPageManager {
4
7
  createPage(
5
8
  pageUrl: String,
@@ -0,0 +1,10 @@
1
+ /// <reference path='./Event.d.ts' />
2
+
3
+ /**
4
+ * @package io.dcloud.uniapp.runtime
5
+ */
6
+ declare class RefresherEvent extends Event {
7
+ detail: {
8
+ dy: number
9
+ }
10
+ }
@@ -1,3 +1,5 @@
1
+ /// <reference path='./Event.d.ts' />
2
+
1
3
  /**
2
4
  * @package io.dcloud.uniapp.runtime
3
5
  */
@@ -0,0 +1,15 @@
1
+ /// <reference path='./Event.d.ts' />
2
+
3
+ /**
4
+ * @package io.dcloud.uniapp.runtime
5
+ */
6
+ declare class ScrollEvent extends Event {
7
+ detail: {
8
+ scrollTop: number
9
+ scrollLeft: number
10
+ scrollHeight: number
11
+ scrollWidth: number
12
+ deltaY: number
13
+ deltaX: number
14
+ }
15
+ }
@@ -0,0 +1,10 @@
1
+ /// <reference path='./Event.d.ts' />
2
+
3
+ /**
4
+ * @package io.dcloud.uniapp.runtime
5
+ */
6
+ declare class ScrollToLowerEvent extends Event {
7
+ detail: {
8
+ direction: string
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ /// <reference path='./Event.d.ts' />
2
+
3
+ /**
4
+ * @package io.dcloud.uniapp.runtime
5
+ */
6
+ declare class ScrollToUpperEvent extends Event {
7
+ detail: {
8
+ direction: string
9
+ }
10
+ }
@@ -1,6 +1,5 @@
1
1
  /// <reference path='./CustomEvent.d.ts' />
2
2
  /// <reference path='./Event.d.ts' />
3
- /// <reference path='./Event.d.ts' />
4
3
  /// <reference path='./IApp.d.ts' />
5
4
  /// <reference path='./IDocument.d.ts' />
6
5
  /// <reference path='./INode.d.ts' />
@@ -11,7 +10,11 @@
11
10
  /// <reference path='./NodeData.d.ts' />
12
11
  /// <reference path='./PageEvent.d.ts' />
13
12
  /// <reference path='./PageScrollEvent.d.ts' />
13
+ /// <reference path='./RefresherEvent.d.ts' />
14
14
  /// <reference path='./ResizeEvent.d.ts' />
15
+ /// <reference path='./ScrollEvent.d.ts' />
16
+ /// <reference path='./ScrollToLowerEvent.d.ts' />
17
+ /// <reference path='./ScrollToUpperEvent.d.ts' />
15
18
  /// <reference path='./TabTapEvent.d.ts' />
16
19
  /// <reference path='./TouchEvent.d.ts' />
17
20
  /// <reference path='./UniAppManager.d.ts' />
@@ -0,0 +1,3 @@
1
+ interface Uni { }
2
+
3
+ declare const uni: Uni
@@ -0,0 +1,9 @@
1
+ /// <reference path='./lib/base/event/index.d.ts' />
2
+ /// <reference path='./lib/lifecycle/index.d.ts' />
3
+ /// <reference path='./lib/route/index.d.ts' />
4
+ /// <reference path='./lib/ui/create-selector-query/index.d.ts' />
5
+ /// <reference path='./lib/ui/load-font-face/index.d.ts' />
6
+ /// <reference path='./lib/ui/page-scroll-to/index.d.ts' />
7
+ /// <reference path='./lib/ui/pull-down-refresh/index.d.ts' />
8
+ /// <reference path='./lib/ui/set-navigation-bar-color/index.d.ts' />
9
+ /// <reference path='./lib/ui/tab-bar/index.d.ts' />
@@ -0,0 +1,15 @@
1
+ import {
2
+ $On as $OnOrigin,
3
+ $Once as $OnceOrigin,
4
+ $Off as $OffOrigin,
5
+ $Emit as $EmitOrigin,
6
+ Uni as UniOrigin
7
+ } from './interface'
8
+
9
+ declare global {
10
+ type $On = $OnOrigin
11
+ type $Once = $OnceOrigin
12
+ type $Off = $OffOrigin
13
+ type $Emit = $EmitOrigin
14
+ interface Uni extends UniOrigin { }
15
+ }
@@ -0,0 +1,40 @@
1
+ // @ts-expect-error
2
+ type AnyCallback = Function<unknown>
3
+
4
+ type $OnCallback = AnyCallback
5
+ export type $On = (eventName: string, callback: $OnCallback) => void
6
+
7
+ type $OnceCallback = AnyCallback
8
+ export type $Once = (eventName: string, callback: $OnceCallback) => void
9
+
10
+ type $OffCallback = AnyCallback
11
+ export type $Off = (eventName: string, callback: $OffCallback) => void
12
+
13
+ export type $Emit = (eventName: string, args: any | null) => void
14
+
15
+ export interface Uni {
16
+ /**
17
+ * 监听自定义事件。事件可以由 uni.$emit 触发。回调函数会接收 uni.$emit 传递的参数。
18
+ *
19
+ * @tutorial http://uniapp.dcloud.io/api/window/communication?id=on
20
+ */
21
+ $on: $On
22
+ /**
23
+ * 移除自定义事件监听器。如果没有指定事件名,则移除所有事件监听器。如果提供事件名,则移除该事件的所有监听器。如果提供了事件名和回调,则只移除这个回调的监听器。
24
+ *
25
+ * @tutorial http://uniapp.dcloud.io/api/window/communication?id=off
26
+ */
27
+ $off: $Off
28
+ /**
29
+ * 监听一个自定义事件。事件只触发一次,在第一次触发之后移除事件监听器。
30
+ *
31
+ * @tutorial http://uniapp.dcloud.io/api/window/communication?id=once
32
+ */
33
+ $once: $Once
34
+ /**
35
+ * 触发自定义事件,附加的参数会传递给事件监听器。
36
+ *
37
+ * @tutorial http://uniapp.dcloud.io/api/window/communication?id=emit
38
+ */
39
+ $emit: $Emit
40
+ }
@@ -0,0 +1,16 @@
1
+ export interface AsyncApiResult {
2
+ errMsg: string
3
+ }
4
+
5
+ export interface AsyncApiSuccessResult extends AsyncApiResult {}
6
+
7
+ export interface UniError extends AsyncApiResult {
8
+ errCode: number
9
+ errSubject: string
10
+ data: any | null
11
+ cause: any | null
12
+ }
13
+
14
+ export type OnLaunchOptions = {
15
+ path: string
16
+ }
@@ -0,0 +1,9 @@
1
+ import {
2
+ GetLaunchOptionsSync as GetLaunchOptionsSyncOrigin,
3
+ Uni as UniOrigin
4
+ } from './interface'
5
+
6
+ declare global {
7
+ type GetLaunchOptionsSync = GetLaunchOptionsSyncOrigin
8
+ interface Uni extends UniOrigin { }
9
+ }
@@ -0,0 +1,12 @@
1
+ import { OnLaunchOptions } from '../interface'
2
+
3
+ export type GetLaunchOptionsSync = () => OnLaunchOptions
4
+
5
+ export interface Uni {
6
+ /**
7
+ * 获取本次启动时的参数。返回值与App.onLaunch的回调参数一致
8
+ *
9
+ * @tutorial http://uniapp.dcloud.io/api/plugins/getLaunchOptionsSync
10
+ */
11
+ getLaunchOptionsSync: GetLaunchOptionsSync
12
+ }
@@ -0,0 +1,65 @@
1
+ import {
2
+ NavigateTo as NavigateToOrigin,
3
+ EventChannel as EventChannelOrigin,
4
+ NavigateToSuccess as NavigateToSuccessOrigin,
5
+ NavigateToFail as NavigateToFailOrigin,
6
+ NavigateToComplete as NavigateToCompleteOrigin,
7
+ NavigateToOptions as NavigateToOptionsOrigin,
8
+ RedirectTo as RedirectToOrigin,
9
+ RedirectToSuccess as RedirectToSuccessOrigin,
10
+ RedirectToFail as RedirectToFailOrigin,
11
+ RedirectToComplete as RedirectToCompleteOrigin,
12
+ RedirectToOptions as RedirectToOptionsOrigin,
13
+ ReLaunch as ReLaunchOrigin,
14
+ ReLaunchSuccess as ReLaunchSuccessOrigin,
15
+ ReLaunchFail as ReLaunchFailOrigin,
16
+ ReLaunchComplete as ReLaunchCompleteOrigin,
17
+ ReLaunchOptions as ReLaunchOptionsOrigin,
18
+ SwitchTab as SwitchTabOrigin,
19
+ SwitchTabSuccess as SwitchTabSuccessOrigin,
20
+ SwitchTabSuccessCallback as SwitchTabSuccessCallbackOrigin,
21
+ SwitchTabFail as SwitchTabFailOrigin,
22
+ SwitchTabFailCallback as SwitchTabFailCallbackOrigin,
23
+ SwitchTabComplete as SwitchTabCompleteOrigin,
24
+ SwitchTabCompleteCallback as SwitchTabCompleteCallbackOrigin,
25
+ SwitchTabOptions as SwitchTabOptionsOrigin,
26
+ NavigateBack as NavigateBackOrigin,
27
+ NavigateBackSuccess as NavigateBackSuccessOrigin,
28
+ NavigateBackFail as NavigateBackFailOrigin,
29
+ NavigateBackComplete as NavigateBackCompleteOrigin,
30
+ NavigateBackOptions as NavigateBackOptionsOrigin,
31
+ Uni as UniOrigin
32
+ } from './interface'
33
+
34
+ declare global {
35
+ type NavigateTo = NavigateToOrigin
36
+ type EventChannel = EventChannelOrigin
37
+ type NavigateToSuccess = NavigateToSuccessOrigin
38
+ type NavigateToFail = NavigateToFailOrigin
39
+ type NavigateToComplete = NavigateToCompleteOrigin
40
+ type NavigateToOptions = NavigateToOptionsOrigin
41
+ type RedirectTo = RedirectToOrigin
42
+ type RedirectToSuccess = RedirectToSuccessOrigin
43
+ type RedirectToFail = RedirectToFailOrigin
44
+ type RedirectToComplete = RedirectToCompleteOrigin
45
+ type RedirectToOptions = RedirectToOptionsOrigin
46
+ type ReLaunch = ReLaunchOrigin
47
+ type ReLaunchSuccess = ReLaunchSuccessOrigin
48
+ type ReLaunchFail = ReLaunchFailOrigin
49
+ type ReLaunchComplete = ReLaunchCompleteOrigin
50
+ type ReLaunchOptions = ReLaunchOptionsOrigin
51
+ type SwitchTab = SwitchTabOrigin
52
+ type SwitchTabSuccess = SwitchTabSuccessOrigin
53
+ type SwitchTabSuccessCallback = SwitchTabSuccessCallbackOrigin
54
+ type SwitchTabFail = SwitchTabFailOrigin
55
+ type SwitchTabFailCallback = SwitchTabFailCallbackOrigin
56
+ type SwitchTabComplete = SwitchTabCompleteOrigin
57
+ type SwitchTabCompleteCallback = SwitchTabCompleteCallbackOrigin
58
+ type SwitchTabOptions = SwitchTabOptionsOrigin
59
+ type NavigateBack = NavigateBackOrigin
60
+ type NavigateBackSuccess = NavigateBackSuccessOrigin
61
+ type NavigateBackFail = NavigateBackFailOrigin
62
+ type NavigateBackComplete = NavigateBackCompleteOrigin
63
+ type NavigateBackOptions = NavigateBackOptionsOrigin
64
+ interface Uni extends UniOrigin { }
65
+ }
@@ -0,0 +1,208 @@
1
+ import { AsyncApiResult, AsyncApiSuccessResult, UniError } from '../interface'
2
+
3
+ export type NavigateTo = (options: NavigateToOptions) => void
4
+ /**
5
+ *
6
+ * @tutorial http://uniapp.dcloud.io/api/router.html#event-channel
7
+ */
8
+ export type EventChannel = {}
9
+ export type NavigateToSuccess = AsyncApiSuccessResult
10
+ type NavigateToSuccessCallback = (result: NavigateToSuccess) => void
11
+ export type NavigateToFail = UniError
12
+
13
+ type NavigateToFailCallback = (result: NavigateToFail) => void
14
+ export type NavigateToComplete = AsyncApiResult
15
+ type NavigateToCompleteCallback = (result: NavigateToComplete) => void
16
+ export type NavigateToOptions = {
17
+ /**
18
+ * 需要跳转的应用内非 tabBar 的页面的路径 , 路径后可以带参数
19
+ */
20
+ url: string
21
+ /**
22
+ * 窗口显示的动画类型
23
+ * - auto: 自动选择动画效果
24
+ * - none: 无动画效果
25
+ * - slide-in-right: 从右侧横向滑动效果
26
+ * - slide-in-left: 左侧横向滑动效果
27
+ * - slide-in-top: 从上侧竖向滑动效果
28
+ * - slide-in-bottom: 从下侧竖向滑动效果
29
+ * - fade-in: 从透明到不透明逐渐显示效果
30
+ * - zoom-out: 从小到大逐渐放大显示效果
31
+ * - zoom-fade-out: 从小到大逐渐放大并且从透明到不透明逐渐显示效果
32
+ * - pop-in: 从右侧平移入栈动画效果
33
+ * - UnionType => 'auto' | 'none' | 'slide-in-right' | 'slide-in-left' | 'slide-in-top' | 'slide-in-bottom' | 'fade-in' | 'zoom-out' | 'zoom-fade-out' | 'pop-in'
34
+ */
35
+ animationType?: string | null
36
+ /**
37
+ * 窗口显示动画的持续时间,单位为 ms
38
+ */
39
+ animationDuration?: number | null
40
+ /**
41
+ * 页面间通信接口,用于监听被打开页面发送到当前页面的数据
42
+ */
43
+ events?: any | null
44
+ /**
45
+ * 接口调用成功的回调函数
46
+ */
47
+ success?: NavigateToSuccessCallback | null
48
+ /**
49
+ * 接口调用失败的回调函数
50
+ */
51
+ fail?: NavigateToFailCallback | null
52
+ /**
53
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
54
+ */
55
+ complete?: NavigateToCompleteCallback | null
56
+ }
57
+ export type RedirectTo = (options: RedirectToOptions) => void
58
+ export type RedirectToSuccess = AsyncApiSuccessResult
59
+ type RedirectToSuccessCallback = (result: AsyncApiSuccessResult) => void
60
+ export type RedirectToFail = UniError
61
+ type RedirectToFailCallback = (result: RedirectToFail) => void
62
+ export type RedirectToComplete = AsyncApiResult
63
+ type RedirectToCompleteCallback = (result: RedirectToComplete) => void
64
+ export type RedirectToOptions = {
65
+ /**
66
+ * 需要跳转的应用内非 tabBar 的页面的路径 , 路径后可以带参数
67
+ */
68
+ url: string
69
+ /**
70
+ * 接口调用成功的回调函数
71
+ */
72
+ success?: RedirectToSuccessCallback | null
73
+ /**
74
+ * 接口调用失败的回调函数
75
+ */
76
+ fail?: RedirectToFailCallback | null
77
+ /**
78
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
79
+ */
80
+ complete?: RedirectToCompleteCallback | null
81
+ }
82
+ export type ReLaunch = (options: ReLaunchOptions) => void
83
+ export type ReLaunchSuccess = AsyncApiSuccessResult
84
+ type ReLaunchSuccessCallback = (result: ReLaunchSuccess) => void
85
+ export type ReLaunchFail = UniError
86
+ type ReLaunchFailCallback = (result: ReLaunchFail) => void
87
+ export type ReLaunchComplete = AsyncApiResult
88
+ type ReLaunchCompleteCallback = (result: ReLaunchComplete) => void
89
+ export type ReLaunchOptions = {
90
+ /**
91
+ * 需要跳转的应用内非 tabBar 的页面的路径 , 路径后可以带参数
92
+ */
93
+ url: string
94
+ /**
95
+ * 接口调用成功的回调函数
96
+ */
97
+ success?: ReLaunchSuccessCallback | null
98
+ /**
99
+ * 接口调用失败的回调函数
100
+ */
101
+ fail?: ReLaunchFailCallback | null
102
+ /**
103
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
104
+ */
105
+ complete?: ReLaunchCompleteCallback | null
106
+ }
107
+ export type SwitchTab = (options: SwitchTabOptions) => void
108
+ export type SwitchTabSuccess = AsyncApiSuccessResult
109
+ export type SwitchTabSuccessCallback = (result: SwitchTabSuccess) => void
110
+ export type SwitchTabFail = UniError
111
+ export type SwitchTabFailCallback = (result: SwitchTabFail) => void
112
+ export type SwitchTabComplete = AsyncApiResult
113
+ export type SwitchTabCompleteCallback = (result: SwitchTabComplete) => void
114
+ export type SwitchTabOptions = {
115
+ /**
116
+ * 需要跳转的 tabBar 页面的路径,路径后不能带参数
117
+ */
118
+ url: string
119
+ /**
120
+ * 接口调用成功的回调函数
121
+ */
122
+ success?: SwitchTabSuccessCallback | null
123
+ /**
124
+ * 接口调用失败的回调函数
125
+ */
126
+ fail?: SwitchTabFailCallback | null
127
+ /**
128
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
129
+ */
130
+ complete?: SwitchTabCompleteCallback | null
131
+ }
132
+ export type NavigateBack = (options: NavigateBackOptions) => void
133
+ export type NavigateBackSuccess = AsyncApiSuccessResult
134
+ type NavigateBackSuccessCallback = (result: NavigateBackSuccess) => void
135
+ export type NavigateBackFail = UniError
136
+ type NavigateBackFailCallback = (result: NavigateBackFail) => void
137
+ export type NavigateBackComplete = AsyncApiResult
138
+ type NavigateBackCompleteCallback = (result: NavigateBackComplete) => void
139
+ export type NavigateBackOptions = {
140
+ /**
141
+ * 返回的页面数,如果 delta 大于现有页面数,则返回到首页
142
+ */
143
+ delta?: number | null
144
+ /**
145
+ * 窗口关闭的动画类型
146
+ * - auto: 自动选择动画效果
147
+ * - none: 无动画效果
148
+ * - slide-out-right: 横向向右侧滑出屏幕动画
149
+ * - slide-out-left: 横向向左侧滑出屏幕动画
150
+ * - slide-out-top: 竖向向上侧滑出屏幕动画
151
+ * - slide-out-bottom: 竖向向下侧滑出屏幕动画
152
+ * - fade-out: 从不透明到透明逐渐隐藏动画
153
+ * - zoom-in: 从大逐渐缩小关闭动画
154
+ * - zoom-fade-in: 从大逐渐缩小并且从不透明到透明逐渐隐藏关闭动画
155
+ * - pop-out: 从右侧平移出栈动画效果
156
+ * - UnionType => 'auto' | 'none' | 'slide-out-right' | 'slide-out-left' | 'slide-out-top' | 'slide-out-bottom' | 'fade-out' | 'zoom-in' | 'zoom-fade-in' | 'pop-out'
157
+ */
158
+ animationType?: string | null
159
+ /**
160
+ * 窗口关闭动画的持续时间,单位为 ms
161
+ */
162
+ animationDuration?: number | null
163
+ /**
164
+ * 接口调用成功的回调函数
165
+ */
166
+ success?: NavigateBackSuccessCallback | null
167
+ /**
168
+ * 接口调用失败的回调函数
169
+ */
170
+ fail?: NavigateBackFailCallback | null
171
+ /**
172
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
173
+ */
174
+ complete?: NavigateBackCompleteCallback | null
175
+ }
176
+
177
+ export interface Uni {
178
+ /**
179
+ * 保留当前页面,跳转到应用内的某个页面
180
+ *
181
+ * @tutorial http://uniapp.dcloud.io/api/router?id=navigateto
182
+ */
183
+ navigateTo: NavigateTo
184
+ /**
185
+ * 关闭当前页面,跳转到应用内的某个页面
186
+ *
187
+ * @tutorial http://uniapp.dcloud.io/api/router?id=redirectto
188
+ */
189
+ redirectTo: RedirectTo
190
+ /**
191
+ * 关闭所有页面,打开到应用内的某个页面
192
+ *
193
+ * @tutorial http://uniapp.dcloud.io/api/router?id=relaunch
194
+ */
195
+ reLaunch: ReLaunch
196
+ /**
197
+ * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
198
+ *
199
+ * @tutorial http://uniapp.dcloud.io/api/router?id=switchtab
200
+ */
201
+ switchTab: SwitchTab
202
+ /**
203
+ * 关闭当前页面,返回上一页面或多级页面
204
+ *
205
+ * @tutorial http://uniapp.dcloud.io/api/router?id=navigateback
206
+ */
207
+ navigateBack: NavigateBack
208
+ }
@@ -0,0 +1,15 @@
1
+ import {
2
+ CreateSelectorQuery as CreateSelectorQueryOrigin,
3
+ SelectorQueryNodeInfoCallback as SelectorQueryNodeInfoCallbackOrigin,
4
+ NodeInfo as NodeInfoOrigin,
5
+ NodeField as NodeFieldOrigin,
6
+ Uni as UniOrigin
7
+ } from './interface'
8
+
9
+ declare global {
10
+ type CreateSelectorQuery = CreateSelectorQueryOrigin
11
+ type SelectorQueryNodeInfoCallback = SelectorQueryNodeInfoCallbackOrigin
12
+ type NodeInfo = NodeInfoOrigin
13
+ type NodeField = NodeFieldOrigin
14
+ interface Uni extends UniOrigin { }
15
+ }