@dcloudio/uni-app-x 0.5.0 → 0.5.2

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 (108) hide show
  1. package/README.md +39 -0
  2. package/package.json +5 -3
  3. package/types/app.d.ts +26 -72
  4. package/types/native/CSSStyleDeclaration.d.ts +2 -2
  5. package/types/native/DOMRect.d.ts +4 -4
  6. package/types/native/DomNode.d.ts +48 -0
  7. package/types/native/DrawableContext.d.ts +42 -16
  8. package/types/native/Element.d.ts +234 -0
  9. package/types/native/Event.d.ts +14 -3
  10. package/types/native/IDocument.d.ts +6 -6
  11. package/types/native/IPage.d.ts +28 -10
  12. package/types/native/IPageManager.d.ts +2 -2
  13. package/types/native/ITabsNode.d.ts +4 -4
  14. package/types/native/IUniError.d.ts +20 -0
  15. package/types/native/IWebViewNode.d.ts +2 -2
  16. package/types/native/InputBlurEvent.d.ts +13 -0
  17. package/types/native/InputConfirmEvent.d.ts +13 -0
  18. package/types/native/InputEvent.d.ts +21 -0
  19. package/types/native/InputFocusEvent.d.ts +17 -0
  20. package/types/native/InputKeyboardHeightChangeEvent.d.ts +17 -0
  21. package/types/native/MouseEvent.d.ts +13 -1
  22. package/types/native/NestedPreScrollEvent.d.ts +23 -0
  23. package/types/native/ScrollToLowerEvent.d.ts +4 -1
  24. package/types/native/ScrollToUpperEvent.d.ts +5 -2
  25. package/types/native/StartNestedScrollEvent.d.ts +12 -0
  26. package/types/native/SwiperAnimationFinishEvent.d.ts +11 -0
  27. package/types/native/SwiperChangeEvent.d.ts +11 -0
  28. package/types/native/SwiperTransitionEvent.d.ts +11 -0
  29. package/types/native/TextareaBlurEvent.d.ts +17 -0
  30. package/types/native/TextareaFocusEvent.d.ts +17 -0
  31. package/types/native/TextareaLineChangeEvent.d.ts +21 -0
  32. package/types/native/UniError.d.ts +7 -2
  33. package/types/native/index.d.ts +18 -1
  34. package/types/page.d.ts +38 -193
  35. package/types/uni/core/index.d.ts +9 -8
  36. package/types/uni/core/lib/base/event/interface.d.ts +4 -4
  37. package/types/uni/core/lib/lifecycle/interface.d.ts +1 -1
  38. package/types/uni/core/lib/route/index.d.ts +0 -10
  39. package/types/uni/core/lib/route/interface.d.ts +1805 -10
  40. package/types/uni/core/lib/ui/create-selector-query/interface.d.ts +242 -2
  41. package/types/uni/core/lib/ui/get-element-by-id/index.d.ts +9 -0
  42. package/types/uni/core/lib/ui/get-element-by-id/interface.d.ts +72 -0
  43. package/types/uni/core/lib/ui/load-font-face/interface.d.ts +486 -3
  44. package/types/uni/core/lib/ui/page-scroll-to/index.d.ts +0 -2
  45. package/types/uni/core/lib/ui/page-scroll-to/interface.d.ts +93 -9
  46. package/types/uni/core/lib/ui/pull-down-refresh/index.d.ts +0 -2
  47. package/types/uni/core/lib/ui/pull-down-refresh/interface.d.ts +2 -5
  48. package/types/uni/core/lib/ui/set-navigation-bar-color/interface.d.ts +373 -4
  49. package/types/uni/core/lib/ui/tab-bar/index.d.ts +2 -18
  50. package/types/uni/core/lib/ui/tab-bar/interface.d.ts +32 -35
  51. package/types/uni/index.d.ts +2 -1
  52. package/types/uni/{ext → uts-plugin-api}/index.d.ts +18 -17
  53. package/types/uni/{ext → uts-plugin-api}/lib/uni-audio/utssdk/interface.d.ts +2 -2
  54. package/types/uni/{ext → uts-plugin-api}/lib/uni-createWebviewContext/utssdk/interface.d.ts +9 -9
  55. package/types/uni/{ext → uts-plugin-api}/lib/uni-exit/utssdk/interface.d.ts +1 -1
  56. package/types/uni/{ext → uts-plugin-api}/lib/uni-file-manager/utssdk/interface.d.ts +2 -2
  57. package/types/uni/{ext → uts-plugin-api}/lib/uni-getAccessibilityInfo/utssdk/interface.d.ts +1 -1
  58. package/types/uni/{ext → uts-plugin-api}/lib/uni-getAppAuthorizeSetting/utssdk/interface.d.ts +108 -10
  59. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +233 -0
  60. package/types/uni/{ext → uts-plugin-api}/lib/uni-getDeviceInfo/utssdk/interface.d.ts +58 -46
  61. package/types/uni/{ext → uts-plugin-api}/lib/uni-getLocation-system/utssdk/interface.d.ts +13 -1
  62. package/types/uni/{ext → uts-plugin-api}/lib/uni-getNetworkType/utssdk/interface.d.ts +8 -5
  63. package/types/uni/uts-plugin-api/lib/uni-getRecorderManager/utssdk/interface.d.ts +213 -0
  64. package/types/uni/{ext → uts-plugin-api}/lib/uni-getSystemInfo/utssdk/interface.d.ts +108 -36
  65. package/types/uni/{ext → uts-plugin-api}/lib/uni-getSystemSetting/utssdk/interface.d.ts +3 -3
  66. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/interface.d.ts +794 -0
  67. package/types/uni/{ext → uts-plugin-api}/lib/uni-network/utssdk/app-ios/interface.d.ts +60 -19
  68. package/types/uni/{ext → uts-plugin-api}/lib/uni-network/utssdk/index.d.ts +4 -0
  69. package/types/uni/{ext → uts-plugin-api}/lib/uni-network/utssdk/interface.d.ts +138 -49
  70. package/types/uni/{ext → uts-plugin-api}/lib/uni-openAppAuthorizeSetting/utssdk/interface.d.ts +8 -5
  71. package/types/uni/{ext → uts-plugin-api}/lib/uni-prompt/utssdk/interface.d.ts +6 -6
  72. package/types/uni/{ext → uts-plugin-api}/lib/uni-storage/utssdk/interface.d.ts +27 -27
  73. package/types/uni/{ext → uts-plugin-api}/lib/uni-websocket/utssdk/index.d.ts +2 -0
  74. package/types/uni/{ext → uts-plugin-api}/lib/uni-websocket/utssdk/interface.d.ts +60 -35
  75. package/types/uni/uts-plugin-component/index.d.ts +1 -0
  76. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/index.d.ts +15 -0
  77. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/interface.d.ts +171 -0
  78. package/types/uni-cloud/index.d.ts +59 -330
  79. package/types/uni-cloud/interface.d.ts +786 -0
  80. package/types/vue/CheckboxGroupChangeEvent.d.ts +1 -1
  81. package/types/vue/PickerViewChangeEvent.d.ts +1 -1
  82. package/types/vue/ProgressActiveendEvent.d.ts +1 -1
  83. package/types/vue/RadioGroupChangeEvent.d.ts +1 -1
  84. package/types/vue/SliderChangeEvent.d.ts +10 -1
  85. package/types/vue/SwitchChangeEvent.d.ts +1 -1
  86. package/uts-plugin.d.ts +10 -0
  87. package/types/native/INode.d.ts +0 -181
  88. package/types/uni/ext/lib/uni-file-manager/utssdk/index.d.ts +0 -31
  89. package/types/uni/ext/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +0 -120
  90. package/types/uni/ext/lib/uni-getRecorderManager/utssdk/interface.d.ts +0 -213
  91. package/types/uni/ext/lib/uni-media/utssdk/interface.d.ts +0 -795
  92. /package/types/uni/{ext → uts-plugin-api}/lib/uni-audio/utssdk/index.d.ts +0 -0
  93. /package/types/uni/{ext → uts-plugin-api}/lib/uni-createWebviewContext/utssdk/index.d.ts +0 -0
  94. /package/types/uni/{ext → uts-plugin-api}/lib/uni-exit/utssdk/index.d.ts +0 -0
  95. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getAccessibilityInfo/utssdk/index.d.ts +0 -0
  96. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getAppAuthorizeSetting/utssdk/index.d.ts +0 -0
  97. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getAppBaseInfo/utssdk/index.d.ts +0 -0
  98. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getDeviceInfo/utssdk/index.d.ts +0 -0
  99. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getLocation-system/utssdk/index.d.ts +0 -0
  100. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getNetworkType/utssdk/index.d.ts +0 -0
  101. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getRecorderManager/utssdk/index.d.ts +0 -0
  102. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getSystemInfo/utssdk/index.d.ts +0 -0
  103. /package/types/uni/{ext → uts-plugin-api}/lib/uni-getSystemSetting/utssdk/index.d.ts +0 -0
  104. /package/types/uni/{ext → uts-plugin-api}/lib/uni-media/utssdk/index.d.ts +0 -0
  105. /package/types/uni/{ext → uts-plugin-api}/lib/uni-network/utssdk/app-ios/index.d.ts +0 -0
  106. /package/types/uni/{ext → uts-plugin-api}/lib/uni-openAppAuthorizeSetting/utssdk/index.d.ts +0 -0
  107. /package/types/uni/{ext → uts-plugin-api}/lib/uni-prompt/utssdk/index.d.ts +0 -0
  108. /package/types/uni/{ext → uts-plugin-api}/lib/uni-storage/utssdk/index.d.ts +0 -0
@@ -11,25 +11,31 @@ export type RequestOptions = {
11
11
  url: string,
12
12
  /**
13
13
  * 请求的参数 Object|String类型
14
- * @type {RequestDataOptions}
14
+ * @type {RequestDataOptions}
15
+ * @defaultValue null
15
16
  */
16
17
  data?: any | null,
17
18
  /**
18
- * 设置请求的 header,header 中不能设置 Referer
19
+ * 设置请求的 header,header 中不能设置 Referer
20
+ * @defaultValue null
19
21
  */
20
22
  header?: UTSJSONObject,
21
23
  /**
22
24
  * 请求类型 默认值GET
23
25
  * GET|POST|PUT|DELETE|HEAD|OPTIONS
24
- * @type {RequestMethod}
26
+ * @type {RequestMethod}
27
+ * @defaultValue "GET"
25
28
  */
26
- method?: string | null,
29
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS"| null,
27
30
  /**
28
- * 超时时间,单位 ms
31
+ * 超时时间,单位 ms
32
+ * @defaultValue 60000
29
33
  */
30
34
  timeout?: number | null,
31
35
  /**
32
- * 如果设为 json,会对返回的数据进行一次 JSON.parse,非 json 不会进行 JSON.parse
36
+ * 如果设为 json,会对返回的数据进行一次 JSON.parse,非 json 不会进行 JSON.parse
37
+ * @defaultValue "json"
38
+ * @deprecated 不支持
33
39
  */
34
40
  dataType?: string | null,
35
41
  /**
@@ -39,27 +45,47 @@ export type RequestOptions = {
39
45
  */
40
46
  responseType?: string | null,
41
47
  /**
42
- * 验证 ssl 证书
48
+ * 验证 ssl 证书
49
+ * @deprecated 不支持
43
50
  */
44
51
  sslVerify?: boolean | null,
45
52
  /**
46
- * 跨域请求时是否携带凭证(cookies)
53
+ * 跨域请求时是否携带凭证(cookies)
54
+ *
55
+ * @uniPlatform {
56
+ * "app": {
57
+ * "android": {
58
+ * "osVer": "4.4",
59
+ * "uniVer": "√",
60
+ * "unixVer": "x"
61
+ * },
62
+ * "ios": {
63
+ * "osVer": "9.0",
64
+ * "uniVer": "√",
65
+ * "unixVer": "x"
66
+ * }
67
+ * }
68
+ * }
47
69
  */
48
70
  withCredentials?: boolean | null,
49
71
  /**
50
- * DNS解析时优先使用ipv4
72
+ * DNS解析时优先使用ipv4
73
+ * @defaultValue false
51
74
  */
52
75
  firstIpv4?: boolean | null,
53
76
  /**
54
- * 网络请求成功回调。
77
+ * 网络请求成功回调。
78
+ * @defaultValue null
55
79
  */
56
80
  success?: RequestSuccessCallback | null,
57
81
  /**
58
- * 网络请求失败回调。
82
+ * 网络请求失败回调。
83
+ * @defaultValue null
59
84
  */
60
85
  fail?: RequestFailCallback | null,
61
86
  /**
62
- * 网络请求完成回调,成功或者失败都会调用。
87
+ * 网络请求完成回调,成功或者失败都会调用。
88
+ * @defaultValue null
63
89
  */
64
90
  complete?: RequestCompleteCallback | null
65
91
  }
@@ -139,7 +165,22 @@ export type UploadFileOptionFiles = {
139
165
  */
140
166
  uri: string,
141
167
  /**
142
- * 要上传的文件对象,仅H5(2.6.15+)支持
168
+ * 要上传的文件对象,仅H5(2.6.15+)支持
169
+ *
170
+ * @uniPlatform {
171
+ * "app": {
172
+ * "android": {
173
+ * "osVer": "4.4",
174
+ * "uniVer": "√",
175
+ * "unixVer": "x"
176
+ * },
177
+ * "ios": {
178
+ * "osVer": "9.0",
179
+ * "uniVer": "√",
180
+ * "unixVer": "x"
181
+ * }
182
+ * }
183
+ * }
143
184
  */
144
185
  file: any | null
145
186
  };
@@ -234,7 +275,7 @@ export interface UploadTask {
234
275
  * "ios": {
235
276
  * "osVer": "9.0",
236
277
  * "uniVer": "√",
237
- * "unixVer": "3.9.0"
278
+ * "unixVer": "x"
238
279
  * }
239
280
  * }
240
281
  * }
@@ -265,7 +306,7 @@ export interface UploadTask {
265
306
  * "ios": {
266
307
  * "osVer": "9.0",
267
308
  * "uniVer": "√",
268
- * "unixVer": "3.9.0"
309
+ * "unixVer": "x"
269
310
  * }
270
311
  * }
271
312
  * }
@@ -358,7 +399,7 @@ export interface DownloadTask {
358
399
  * "ios": {
359
400
  * "osVer": "9.0",
360
401
  * "uniVer": "√",
361
- * "unixVer": "3.9.0"
402
+ * "unixVer": "x"
362
403
  * }
363
404
  * }
364
405
  * }
@@ -389,7 +430,7 @@ export interface DownloadTask {
389
430
  * "ios": {
390
431
  * "osVer": "9.0",
391
432
  * "uniVer": "√",
392
- * "unixVer": "3.9.0"
433
+ * "unixVer": "x"
393
434
  * }
394
435
  * }
395
436
  * }
@@ -475,7 +516,7 @@ export interface Uni {
475
516
  * "ios": {
476
517
  * "osVer": "9.0",
477
518
  * "uniVer": "√",
478
- * "unixVer": "3.9.0"
519
+ * "unixVer": "x"
479
520
  * }
480
521
  * }
481
522
  * }
@@ -512,7 +553,7 @@ export interface Uni {
512
553
  * "ios": {
513
554
  * "osVer": "9.0",
514
555
  * "uniVer": "√",
515
- * "unixVer": "3.9.0"
556
+ * "unixVer": "x"
516
557
  * }
517
558
  * }
518
559
  * }
@@ -2,6 +2,8 @@ import {
2
2
  Request as RequestOrigin,
3
3
  RequestOptions as RequestOptionsOrigin,
4
4
  RequestSuccess as RequestSuccessOrigin,
5
+ RequestMethod as RequestMethodOrigin,
6
+ RequestErrorCode as RequestErrorCodeOrigin,
5
7
  RequestFail as RequestFailOrigin,
6
8
  RequestSuccessCallback as RequestSuccessCallbackOrigin,
7
9
  RequestFailCallback as RequestFailCallbackOrigin,
@@ -36,6 +38,8 @@ declare global {
36
38
  type Request<T> = RequestOrigin<T>
37
39
  type RequestOptions<T> = RequestOptionsOrigin<T>
38
40
  type RequestSuccess<T> = RequestSuccessOrigin<T>
41
+ type RequestMethod = RequestMethodOrigin
42
+ type RequestErrorCode = RequestErrorCodeOrigin
39
43
  type RequestFail = RequestFailOrigin
40
44
  type RequestSuccessCallback<T> = RequestSuccessCallbackOrigin<T>
41
45
  type RequestFailCallback = RequestFailCallbackOrigin
@@ -1,4 +1,4 @@
1
- export type Request<T> = (param : RequestOptions<T>) => RequestTask | null;
1
+ export type Request<T> = (param: RequestOptions<T>) => RequestTask | null;
2
2
 
3
3
  /**
4
4
  * 网络请求参数
@@ -10,55 +10,83 @@ export type RequestOptions<T> = {
10
10
  url: string,
11
11
  /**
12
12
  * 请求的参数 Object|String类型
13
- * @type {RequestDataOptions}
13
+ * @type {RequestDataOptions}
14
+ * @defaultValue null
14
15
  */
15
16
  data?: any | null,
16
17
  /**
17
- * 设置请求的 header,header 中不能设置 Referer
18
+ * 设置请求的 header,header 中不能设置 Referer
19
+ * @defaultValue null
18
20
  */
19
- header?: UTSJSONObject,
21
+ header?: UTSJSONObject | null,
20
22
  /**
21
23
  * 请求类型 默认值GET
22
24
  * GET|POST|PUT|DELETE|HEAD|OPTIONS
23
- * @type {RequestMethod}
25
+ * @type {RequestMethod}
26
+ * @defaultValue "GET"
24
27
  */
25
- method?: string | null,
28
+ method?: RequestMethod | null,
26
29
  /**
27
- * 超时时间,单位 ms
30
+ * 超时时间,单位 ms
31
+ * @defaultValue 60000
28
32
  */
29
33
  timeout?: number | null,
30
34
  /**
31
- * 如果设为 json,会对返回的数据进行一次 JSON.parse,非 json 不会进行 JSON.parse
35
+ * 如果设为 json,会对返回的数据进行一次 JSON.parse,非 json 不会进行 JSON.parse
36
+ * @defaultValue "json"
37
+ * @deprecated 不支持
32
38
  */
33
39
  dataType?: string | null,
34
40
  /**
35
- * 设置响应的数据类型。
36
- *
41
+ * 设置响应的数据类型。
42
+ *
37
43
  * @deprecated 不支持
38
44
  */
39
45
  responseType?: string | null,
40
46
  /**
41
- * 验证 ssl 证书
47
+ * 验证 ssl 证书
48
+ *
49
+ * @deprecated 不支持
42
50
  */
43
51
  sslVerify?: boolean | null,
44
- /**
45
- * 跨域请求时是否携带凭证(cookies)
52
+ /**
53
+ * 跨域请求时是否携带凭证(cookies)
54
+ *
55
+ * @uniPlatform {
56
+ * "app": {
57
+ * "android": {
58
+ * "osVer": "4.4",
59
+ * "uniVer": "√",
60
+ * "unixVer": "x"
61
+ * },
62
+ * "ios": {
63
+ * "osVer": "9.0",
64
+ * "uniVer": "√",
65
+ * "unixVer": "x"
66
+ * }
67
+ * }
68
+ * }
69
+ *
46
70
  */
47
71
  withCredentials?: boolean | null,
48
72
  /**
49
- * DNS解析时优先使用ipv4
73
+ * DNS解析时优先使用ipv4
74
+ * @defaultValue false
50
75
  */
51
76
  firstIpv4?: boolean | null,
52
77
  /**
53
- * 网络请求成功回调。
78
+ * 网络请求成功回调。
79
+ * @defaultValue null
54
80
  */
55
81
  success?: RequestSuccessCallback<T> | null,
56
82
  /**
57
- * 网络请求失败回调。
83
+ * 网络请求失败回调。
84
+ * @defaultValue null
58
85
  */
59
86
  fail?: RequestFailCallback | null,
60
87
  /**
61
- * 网络请求完成回调,成功或者失败都会调用。
88
+ * 网络请求完成回调,成功或者失败都会调用。
89
+ * @defaultValue null
62
90
  */
63
91
  complete?: RequestCompleteCallback | null
64
92
  }
@@ -81,9 +109,32 @@ export type RequestSuccess<T> = {
81
109
  * 开发者服务器返回的 cookies,格式为字符串数组
82
110
  */
83
111
  cookies: Array<string>
84
- }
112
+ }
113
+
114
+ /**
115
+ * 请求方式
116
+ */
117
+ export type RequestMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
85
118
 
86
- export type RequestFail = UniError;
119
+ /**
120
+ * 错误码
121
+ * - 5 接口超时
122
+ * - 1000 服务端系统错误
123
+ * - 100001 json数据解析错误
124
+ * - 100002 错误信息json解析失败
125
+ * - 600000 未知的网络错误
126
+ * - 600003 网络中断
127
+ * - 600009 URL格式不合法
128
+ * - 600010 请求的 data 序列化失败
129
+ * - 602001 request系统错误
130
+ */
131
+ export type RequestErrorCode = 5 | 1000 | 100001 | 100002 | 600000 | 600003 | 600009 | 600010 | 602001;
132
+ /**
133
+ * 网络请求失败的错误回调参数
134
+ */
135
+ export interface RequestFail extends IUniError{
136
+ errCode: RequestErrorCode
137
+ };
87
138
  export type RequestSuccessCallback<T> = (option: RequestSuccess<T>) => void;
88
139
  export type RequestFailCallback = (option: RequestFail) => void;
89
140
  export type RequestCompleteCallback = (option: any) => void;
@@ -123,14 +174,14 @@ export interface RequestTask {
123
174
  abort(): void
124
175
  }
125
176
 
126
-
127
177
  //===============================上传==================================
128
178
 
129
179
 
130
180
  export type UploadFile = (options: UploadFileOptions) => UploadTask | null;
131
181
  export type UploadFileOptionFiles = {
132
182
  /**
133
- * multipart 提交时,表单的项目名,默认为 file,如果 name 不填或填的值相同,可能导致服务端读取文件时只能读取到一个文件。
183
+ * multipart 提交时,表单的项目名,默认为 file,如果 name 不填或填的值相同,可能导致服务端读取文件时只能读取到一个文件。
184
+ * @defaultValue "file"
134
185
  */
135
186
  name: string | null,
136
187
  /**
@@ -138,7 +189,21 @@ export type UploadFileOptionFiles = {
138
189
  */
139
190
  uri: string,
140
191
  /**
141
- * 要上传的文件对象,仅H5(2.6.15+)支持
192
+ * 要上传的文件对象
193
+ * @uniPlatform {
194
+ * "app": {
195
+ * "android": {
196
+ * "osVer": "4.4",
197
+ * "uniVer": "√",
198
+ * "unixVer": "x"
199
+ * },
200
+ * "ios": {
201
+ * "osVer": "9.0",
202
+ * "uniVer": "√",
203
+ * "unixVer": "x"
204
+ * }
205
+ * }
206
+ * }
142
207
  */
143
208
  file: any | null
144
209
  };
@@ -152,8 +217,13 @@ export type UploadFileSuccess = {
152
217
  */
153
218
  statusCode: number
154
219
  };
155
- export type UploadFileSuccessCallback = (result: UploadFileSuccess) => void;
156
- export type UploadFileFail = UniError;
220
+ export type UploadFileSuccessCallback = (result: UploadFileSuccess) => void;
221
+ /**
222
+ * 上传文件失败的错误回调参数
223
+ */
224
+ export interface UploadFileFail extends IUniError{
225
+ errCode: RequestErrorCode
226
+ };
157
227
  export type UploadFileFailCallback = (result: UploadFileFail) => void;
158
228
 
159
229
  export type UploadFileCompleteCallback = (result: any) => void;
@@ -163,39 +233,48 @@ export type UploadFileOptions = {
163
233
  */
164
234
  url: string,
165
235
  /**
166
- * 要上传文件资源的路径
236
+ * 要上传文件资源的路径
237
+ * @defaultValue null
167
238
  */
168
239
  filePath?: string | null,
169
240
  /**
170
- * 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容
241
+ * 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容
242
+ * @defaultValue null
171
243
  */
172
244
  name?: string | null,
173
245
  /**
174
- * 需要上传的文件列表。
246
+ * 需要上传的文件列表。
247
+ * @defaultValue null
175
248
  */
176
249
  files?: (UploadFileOptionFiles[]) | null,
177
250
  /**
178
- * HTTP 请求 Header, header 中不能设置 Referer
251
+ * HTTP 请求 Header, header 中不能设置 Referer
252
+ * @defaultValue null
179
253
  */
180
254
  header?: UTSJSONObject | null,
181
255
  /**
182
- * HTTP 请求中其他额外的 form data
256
+ * HTTP 请求中其他额外的 form data
257
+ * @defaultValue null
183
258
  */
184
259
  formData?: UTSJSONObject | null,
185
260
  /**
186
- * 超时时间,单位 ms
261
+ * 超时时间,单位 ms
262
+ * @defaultValue 120000
187
263
  */
188
264
  timeout?: number | null,
189
265
  /**
190
- * 成功返回的回调函数
266
+ * 成功返回的回调函数
267
+ * @defaultValue null
191
268
  */
192
269
  success?: UploadFileSuccessCallback | null,
193
270
  /**
194
- * 失败的回调函数
271
+ * 失败的回调函数
272
+ * @defaultValue null
195
273
  */
196
274
  fail?: UploadFileFailCallback | null,
197
275
  /**
198
- * 结束的回调函数(调用成功、失败都会执行)
276
+ * 结束的回调函数(调用成功、失败都会执行)
277
+ * @defaultValue null
199
278
  */
200
279
  complete?: UploadFileCompleteCallback | null
201
280
  };
@@ -233,7 +312,7 @@ export interface UploadTask {
233
312
  * "ios": {
234
313
  * "osVer": "9.0",
235
314
  * "uniVer": "√",
236
- * "unixVer": "3.9.0"
315
+ * "unixVer": "x"
237
316
  * }
238
317
  * }
239
318
  * }
@@ -264,7 +343,7 @@ export interface UploadTask {
264
343
  * "ios": {
265
344
  * "osVer": "9.0",
266
345
  * "uniVer": "√",
267
- * "unixVer": "3.9.0"
346
+ * "unixVer": "x"
268
347
  * }
269
348
  * }
270
349
  * }
@@ -293,8 +372,13 @@ export type DownloadFileSuccess = {
293
372
  */
294
373
  statusCode: number
295
374
  };
296
- export type DownloadFileSuccessCallback = (result: DownloadFileSuccess) => void;
297
- export type DownloadFileFail = UniError;
375
+ export type DownloadFileSuccessCallback = (result: DownloadFileSuccess) => void;
376
+ /**
377
+ * 下载文件失败的错误回调参数
378
+ */
379
+ export interface DownloadFileFail extends IUniError{
380
+ errCode: RequestErrorCode
381
+ };
298
382
  export type DownloadFileFailCallback = (result: DownloadFileFail) => void;
299
383
  export type DownloadFileComplete = any;
300
384
  export type DownloadFileCompleteCallback = (result: DownloadFileComplete) => void;
@@ -304,23 +388,28 @@ export type DownloadFileOptions = {
304
388
  */
305
389
  url: string,
306
390
  /**
307
- * HTTP 请求 Header,header 中不能设置 Referer
391
+ * HTTP 请求 Header,header 中不能设置 Referer
392
+ * @defaultValue null
308
393
  */
309
394
  header?: UTSJSONObject | null,
310
395
  /**
311
- * 超时时间,单位 ms
396
+ * 超时时间,单位 ms
397
+ * @defaultValue 120000
312
398
  */
313
399
  timeout?: number | null,
314
400
  /**
315
- * 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'}
401
+ * 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'}
402
+ * @defaultValue null
316
403
  */
317
404
  success?: DownloadFileSuccessCallback | null,
318
405
  /**
319
- * 失败的回调函数
406
+ * 失败的回调函数
407
+ * @defaultValue null
320
408
  */
321
409
  fail?: DownloadFileFailCallback | null,
322
410
  /**
323
- * 结束的回调函数(调用成功、失败都会执行)
411
+ * 结束的回调函数(调用成功、失败都会执行)
412
+ * @defaultValue null
324
413
  */
325
414
  complete?: DownloadFileCompleteCallback | null
326
415
  };
@@ -357,7 +446,7 @@ export interface DownloadTask {
357
446
  * "ios": {
358
447
  * "osVer": "9.0",
359
448
  * "uniVer": "√",
360
- * "unixVer": "3.9.0"
449
+ * "unixVer": "x"
361
450
  * }
362
451
  * }
363
452
  * }
@@ -388,7 +477,7 @@ export interface DownloadTask {
388
477
  * "ios": {
389
478
  * "osVer": "9.0",
390
479
  * "uniVer": "√",
391
- * "unixVer": "3.9.0"
480
+ * "unixVer": "x"
392
481
  * }
393
482
  * }
394
483
  * }
@@ -456,7 +545,7 @@ export interface Uni {
456
545
  });
457
546
  ```
458
547
  */
459
- request: Request<T>,
548
+ request<T>(param: RequestOptions<T>): RequestTask | null;
460
549
  /**
461
550
  * UploadFile()
462
551
  * @description
@@ -474,7 +563,7 @@ export interface Uni {
474
563
  * "ios": {
475
564
  * "osVer": "9.0",
476
565
  * "uniVer": "√",
477
- * "unixVer": "3.9.0"
566
+ * "unixVer": "x"
478
567
  * }
479
568
  * }
480
569
  * }
@@ -493,7 +582,7 @@ export interface Uni {
493
582
  });
494
583
  ```
495
584
  */
496
- uploadFile: UploadFile,
585
+ uploadFile(options: UploadFileOptions): UploadTask | null;
497
586
  /**
498
587
  * DownloadFile()
499
588
  * @description
@@ -511,7 +600,7 @@ export interface Uni {
511
600
  * "ios": {
512
601
  * "osVer": "9.0",
513
602
  * "uniVer": "√",
514
- * "unixVer": "3.9.0"
603
+ * "unixVer": "x"
515
604
  * }
516
605
  * }
517
606
  * }
@@ -525,5 +614,5 @@ export interface Uni {
525
614
  });
526
615
  ```
527
616
  */
528
- downloadFile: DownloadFile
617
+ downloadFile(options: DownloadFileOptions): DownloadTask | null;
529
618
  }
@@ -17,7 +17,7 @@ export interface Uni {
17
17
  * "ios": {
18
18
  * "osVer": "9.0",
19
19
  * "uniVer": "√",
20
- * "unixVer": "3.9.0"
20
+ * "unixVer": "x"
21
21
  * }
22
22
  * }
23
23
  * }
@@ -26,7 +26,7 @@ export interface Uni {
26
26
  uni.openAppAuthorizeSetting({});
27
27
  ```
28
28
  */
29
- openAppAuthorizeSetting: OpenAppAuthorizeSetting;
29
+ openAppAuthorizeSetting(options: OpenAppAuthorizeSettingOptions): void;
30
30
  }
31
31
 
32
32
  export type OpenAppAuthorizeSetting = (options: OpenAppAuthorizeSettingOptions) => void;
@@ -53,15 +53,18 @@ export type OpenAppAuthorizeSettingComplete = {
53
53
  export type OpenAppAuthorizeSettingCompleteCallback = (result: OpenAppAuthorizeSettingComplete) => void;
54
54
  export type OpenAppAuthorizeSettingOptions = {
55
55
  /**
56
- * 接口调用成功的回调函数
56
+ * 接口调用成功的回调函数
57
+ * @defaultValue null
57
58
  */
58
59
  success?: OpenAppAuthorizeSettingSuccessCallback | null,
59
60
  /**
60
- * 接口调用失败的回调函数
61
+ * 接口调用失败的回调函数
62
+ * @defaultValue null
61
63
  */
62
64
  fail?: OpenAppAuthorizeSettingFailCallback | null,
63
65
  /**
64
- * 接口调用结束的回调函数(调用成功、失败都会执行)
66
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
67
+ * @defaultValue null
65
68
  */
66
69
  complete?: OpenAppAuthorizeSettingCompleteCallback | null
67
70
  };
@@ -443,7 +443,7 @@ export interface Uni {
443
443
  * }
444
444
  * }
445
445
  */
446
- showToast: ShowToast,
446
+ showToast(options: ShowToastOptions): void,
447
447
  /**
448
448
  * @description 隐藏消息提示框。
449
449
  * @example
@@ -466,7 +466,7 @@ export interface Uni {
466
466
  * }
467
467
  * }
468
468
  */
469
- hideToast: HideToast,
469
+ hideToast(): void,
470
470
  /**
471
471
  * @description 显示 loading 提示框, 需主动调用 uni.hideLoading 才能关闭提示框。
472
472
  * @param {ShowLoadingOptions} option
@@ -495,7 +495,7 @@ export interface Uni {
495
495
  * }
496
496
  * }
497
497
  */
498
- showLoading: ShowLoading,
498
+ showLoading(options: ShowLoadingOptions): void,
499
499
  /**
500
500
  * @description 隐藏 loading 提示框。
501
501
  * @example
@@ -525,7 +525,7 @@ export interface Uni {
525
525
  * }
526
526
  * }
527
527
  */
528
- hideLoading: HideLoading,
528
+ hideLoading():void,
529
529
  /**
530
530
  * @description 显示模态弹窗,可以只有一个确定按钮,也可以同时有确定和取消按钮。类似于一个API整合了 html 中:alert、confirm。
531
531
  * @param {ShowModalOptions} option
@@ -561,7 +561,7 @@ export interface Uni {
561
561
  * }
562
562
  * }
563
563
  */
564
- showModal: ShowModal,
564
+ showModal(options: ShowModalOptions) : void,
565
565
  /**
566
566
  * @description 从底部向上弹出操作菜单
567
567
  * @param {ShowActionSheetOptions} option
@@ -593,5 +593,5 @@ export interface Uni {
593
593
  * }
594
594
  * }
595
595
  */
596
- showActionSheet: ShowActionSheet
596
+ showActionSheet(options: ShowActionSheetOptions) : void
597
597
  }