@dcloudio/uni-app-x 0.2.0 → 0.4.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 (96) hide show
  1. package/.env +2 -0
  2. package/index.d.ts +1 -2
  3. package/package.json +15 -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 +19 -0
  36. package/types/uni/ext/lib/uni-audio/utssdk/index.d.ts +13 -0
  37. package/types/uni/ext/lib/uni-audio/utssdk/interface.d.ts +804 -0
  38. package/types/uni/ext/lib/uni-exit/utssdk/index.d.ts +19 -0
  39. package/types/uni/ext/lib/uni-exit/utssdk/interface.d.ts +63 -0
  40. package/types/uni/ext/lib/uni-file-manager/utssdk/index.d.ts +33 -0
  41. package/types/uni/ext/lib/uni-file-manager/utssdk/interface.d.ts +132 -0
  42. package/types/uni/ext/lib/uni-getAccessibilityInfo/utssdk/index.d.ts +9 -0
  43. package/types/uni/ext/lib/uni-getAccessibilityInfo/utssdk/interface.d.ts +31 -0
  44. package/types/uni/ext/lib/uni-getAppAuthorizeSetting/utssdk/index.d.ts +11 -0
  45. package/types/uni/ext/lib/uni-getAppAuthorizeSetting/utssdk/interface.d.ts +135 -0
  46. package/types/uni/ext/lib/uni-getAppBaseInfo/utssdk/index.d.ts +13 -0
  47. package/types/uni/ext/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +120 -0
  48. package/types/uni/ext/lib/uni-getDeviceInfo/utssdk/index.d.ts +13 -0
  49. package/types/uni/ext/lib/uni-getDeviceInfo/utssdk/interface.d.ts +144 -0
  50. package/types/uni/ext/lib/uni-getLocation-system/utssdk/index.d.ts +15 -0
  51. package/types/uni/ext/lib/uni-getLocation-system/utssdk/interface.d.ts +99 -0
  52. package/types/uni/ext/lib/uni-getLocation-tencent/utssdk/index.d.ts +15 -0
  53. package/types/uni/ext/lib/uni-getLocation-tencent/utssdk/interface.d.ts +93 -0
  54. package/types/uni/ext/lib/uni-getNetworkType/utssdk/index.d.ts +23 -0
  55. package/types/uni/ext/lib/uni-getNetworkType/utssdk/interface.d.ts +67 -0
  56. package/types/uni/ext/lib/uni-getRecorderManager/utssdk/index.d.ts +13 -0
  57. package/types/uni/ext/lib/uni-getRecorderManager/utssdk/interface.d.ts +213 -0
  58. package/types/uni/ext/lib/uni-getSystemInfo/utssdk/index.d.ts +29 -0
  59. package/types/uni/ext/lib/uni-getSystemInfo/utssdk/interface.d.ts +517 -0
  60. package/types/uni/ext/lib/uni-getSystemSetting/utssdk/index.d.ts +11 -0
  61. package/types/uni/ext/lib/uni-getSystemSetting/utssdk/interface.d.ts +61 -0
  62. package/types/uni/ext/lib/uni-media/utssdk/index.d.ts +93 -0
  63. package/types/uni/ext/lib/uni-media/utssdk/interface.d.ts +877 -0
  64. package/types/uni/ext/lib/uni-network/utssdk/index.d.ts +61 -0
  65. package/types/uni/ext/lib/uni-network/utssdk/interface.d.ts +569 -0
  66. package/types/uni/ext/lib/uni-openAppAuthorizeSetting/utssdk/index.d.ts +23 -0
  67. package/types/uni/ext/lib/uni-openAppAuthorizeSetting/utssdk/interface.d.ts +67 -0
  68. package/types/uni/ext/lib/uni-prompt/utssdk/index.d.ts +69 -0
  69. package/types/uni/ext/lib/uni-prompt/utssdk/interface.d.ts +686 -0
  70. package/types/uni/ext/lib/uni-storage/utssdk/index.d.ts +87 -0
  71. package/types/uni/ext/lib/uni-storage/utssdk/interface.d.ts +575 -0
  72. package/types/uni/ext/lib/uni-websocket/utssdk/index.d.ts +49 -0
  73. package/types/uni/ext/lib/uni-websocket/utssdk/interface.d.ts +511 -0
  74. package/types/uni/index.d.ts +3 -0
  75. package/types/uni-cloud/index.d.ts +274 -0
  76. package/{vue → types/vue}/CheckboxGroupChangeEvent.d.ts +9 -3
  77. package/types/vue/PickerViewChangeEvent.d.ts +16 -0
  78. package/types/vue/ProgressActiveendEvent.d.ts +16 -0
  79. package/types/vue/RadioGroupChangeEvent.d.ts +16 -0
  80. package/types/vue/SliderChangeEvent.d.ts +16 -0
  81. package/types/vue/SwitchChangeEvent.d.ts +16 -0
  82. package/types/vue/index.d.ts +6 -0
  83. package/vue/index.d.ts +0 -1
  84. /package/{native → types/native}/Event.d.ts +0 -0
  85. /package/{native → types/native}/IApp.d.ts +0 -0
  86. /package/{native → types/native}/IDocument.d.ts +0 -0
  87. /package/{native → types/native}/INode.d.ts +0 -0
  88. /package/{native → types/native}/IPage.d.ts +0 -0
  89. /package/{native → types/native}/ITabsNode.d.ts +0 -0
  90. /package/{native → types/native}/MouseEvent.d.ts +0 -0
  91. /package/{native → types/native}/NodeData.d.ts +0 -0
  92. /package/{native → types/native}/PageEvent.d.ts +0 -0
  93. /package/{native → types/native}/PageScrollEvent.d.ts +0 -0
  94. /package/{native → types/native}/TabTapEvent.d.ts +0 -0
  95. /package/{native → types/native}/TouchEvent.d.ts +0 -0
  96. /package/{native → types/native}/UniAppManager.d.ts +0 -0
@@ -0,0 +1,61 @@
1
+ import {
2
+ Request as RequestOrigin,
3
+ RequestOptions as RequestOptionsOrigin,
4
+ RequestSuccess as RequestSuccessOrigin,
5
+ RequestFail as RequestFailOrigin,
6
+ RequestSuccessCallback as RequestSuccessCallbackOrigin,
7
+ RequestFailCallback as RequestFailCallbackOrigin,
8
+ RequestCompleteCallback as RequestCompleteCallbackOrigin,
9
+ UploadFile as UploadFileOrigin,
10
+ UploadFileOptionFiles as UploadFileOptionFilesOrigin,
11
+ UploadFileSuccess as UploadFileSuccessOrigin,
12
+ UploadFileSuccessCallback as UploadFileSuccessCallbackOrigin,
13
+ UploadFileFail as UploadFileFailOrigin,
14
+ UploadFileFailCallback as UploadFileFailCallbackOrigin,
15
+ UploadFileCompleteCallback as UploadFileCompleteCallbackOrigin,
16
+ UploadFileOptions as UploadFileOptionsOrigin,
17
+ OnProgressUpdateResult as OnProgressUpdateResultOrigin,
18
+ UploadFileProgressUpdateCallback as UploadFileProgressUpdateCallbackOrigin,
19
+ DownloadFile as DownloadFileOrigin,
20
+ DownloadFileSuccess as DownloadFileSuccessOrigin,
21
+ DownloadFileSuccessCallback as DownloadFileSuccessCallbackOrigin,
22
+ DownloadFileFail as DownloadFileFailOrigin,
23
+ DownloadFileFailCallback as DownloadFileFailCallbackOrigin,
24
+ DownloadFileComplete as DownloadFileCompleteOrigin,
25
+ DownloadFileCompleteCallback as DownloadFileCompleteCallbackOrigin,
26
+ DownloadFileOptions as DownloadFileOptionsOrigin,
27
+ OnProgressDownloadResult as OnProgressDownloadResultOrigin,
28
+ DownloadFileProgressUpdateCallback as DownloadFileProgressUpdateCallbackOrigin,
29
+ Uni as UniOrigin
30
+ } from './interface'
31
+
32
+ declare global {
33
+ type Request = RequestOrigin
34
+ type RequestOptions = RequestOptionsOrigin
35
+ type RequestSuccess = RequestSuccessOrigin
36
+ type RequestFail = RequestFailOrigin
37
+ type RequestSuccessCallback = RequestSuccessCallbackOrigin
38
+ type RequestFailCallback = RequestFailCallbackOrigin
39
+ type RequestCompleteCallback = RequestCompleteCallbackOrigin
40
+ type UploadFile = UploadFileOrigin
41
+ type UploadFileOptionFiles = UploadFileOptionFilesOrigin
42
+ type UploadFileSuccess = UploadFileSuccessOrigin
43
+ type UploadFileSuccessCallback = UploadFileSuccessCallbackOrigin
44
+ type UploadFileFail = UploadFileFailOrigin
45
+ type UploadFileFailCallback = UploadFileFailCallbackOrigin
46
+ type UploadFileCompleteCallback = UploadFileCompleteCallbackOrigin
47
+ type UploadFileOptions = UploadFileOptionsOrigin
48
+ type OnProgressUpdateResult = OnProgressUpdateResultOrigin
49
+ type UploadFileProgressUpdateCallback = UploadFileProgressUpdateCallbackOrigin
50
+ type DownloadFile = DownloadFileOrigin
51
+ type DownloadFileSuccess = DownloadFileSuccessOrigin
52
+ type DownloadFileSuccessCallback = DownloadFileSuccessCallbackOrigin
53
+ type DownloadFileFail = DownloadFileFailOrigin
54
+ type DownloadFileFailCallback = DownloadFileFailCallbackOrigin
55
+ type DownloadFileComplete = DownloadFileCompleteOrigin
56
+ type DownloadFileCompleteCallback = DownloadFileCompleteCallbackOrigin
57
+ type DownloadFileOptions = DownloadFileOptionsOrigin
58
+ type OnProgressDownloadResult = OnProgressDownloadResultOrigin
59
+ type DownloadFileProgressUpdateCallback = DownloadFileProgressUpdateCallbackOrigin
60
+ interface Uni extends UniOrigin { }
61
+ }
@@ -0,0 +1,569 @@
1
+
2
+ export type Request = (param: RequestOptions) => RequestTask | null;
3
+
4
+ /**
5
+ * 网络请求参数
6
+ */
7
+ export type RequestOptions = {
8
+ /**
9
+ * 开发者服务器接口地址
10
+ */
11
+ url: string,
12
+ /**
13
+ * 请求的参数 Object|String类型
14
+ * @type {RequestDataOptions}
15
+ */
16
+ data?: any,
17
+ /**
18
+ * 设置请求的 header,header 中不能设置 Referer
19
+ */
20
+ header?: UTSJSONObject,
21
+ /**
22
+ * 请求类型 默认值GET
23
+ * GET|POST|PUT|DELETE|HEAD|OPTIONS
24
+ * @type {RequestMethod}
25
+ */
26
+ method?: string,
27
+ /**
28
+ * 超时时间,单位 ms
29
+ */
30
+ timeout?: number,
31
+ /**
32
+ * 如果设为 json,会对返回的数据进行一次 JSON.parse,非 json 不会进行 JSON.parse
33
+ */
34
+ dataType?: string,
35
+ /**
36
+ * 设置响应的数据类型。
37
+ */
38
+ responseType?: string,
39
+ /**
40
+ * 验证 ssl 证书
41
+ */
42
+ sslVerify?: boolean,
43
+ /**
44
+ * 跨域请求时是否携带凭证(cookies)
45
+ */
46
+ withCredentials?: boolean,
47
+ /**
48
+ * DNS解析时优先使用ipv4
49
+ */
50
+ firstIpv4?: boolean,
51
+ /**
52
+ * 网络请求成功回调。
53
+ */
54
+ success?: RequestSuccessCallback,
55
+ /**
56
+ * 网络请求失败回调。
57
+ */
58
+ fail?: RequestFailCallback,
59
+ /**
60
+ * 网络请求完成回调,成功或者失败都会调用。
61
+ */
62
+ complete?: RequestCompleteCallback
63
+ }
64
+
65
+ export type RequestSuccess = {
66
+ /**
67
+ * 开发者服务器返回的数据
68
+ * @type {RequestDataOptions}
69
+ */
70
+ data: any | null,
71
+ /**
72
+ * 开发者服务器返回的 HTTP 状态码
73
+ */
74
+ statusCode: number,
75
+ /**
76
+ * 开发者服务器返回的 HTTP Response Header
77
+ */
78
+ header: any,
79
+ /**
80
+ * 开发者服务器返回的 cookies,格式为字符串数组
81
+ */
82
+ cookies: Array<string>
83
+ }
84
+
85
+ export type RequestFail = {
86
+ /**
87
+ * 错误信息
88
+ */
89
+ errMsg: string,
90
+ /**
91
+ * 错误码
92
+ */
93
+ errCode: number,
94
+ /**
95
+ * 调用API的名称
96
+ */
97
+ errSubject: string,
98
+ /**
99
+ * 错误来源
100
+ */
101
+ cause?: any
102
+ }
103
+
104
+ export type RequestSuccessCallback = (option: RequestSuccess) => void;
105
+ export type RequestFailCallback = (option: RequestFail) => void;
106
+ export type RequestCompleteCallback = (option: any) => void;
107
+
108
+
109
+ export interface RequestTask {
110
+ /**
111
+ * abort()
112
+ * @description
113
+ * 中断网络请求。
114
+ * @param {void}
115
+ * @return {void}
116
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/request.html#request
117
+ * @uniPlatform {
118
+ * "app": {
119
+ * "android": {
120
+ * "osVer": "4.4",
121
+ * "uniVer": "√",
122
+ * "unixVer": "3.9.0"
123
+ * },
124
+ * "ios": {
125
+ * "osVer": "9.0",
126
+ * "uniVer": "√",
127
+ * "unixVer": "3.9.0"
128
+ * }
129
+ * }
130
+ * }
131
+ * @example
132
+ ```typescript
133
+ var requestTask = uni.request({
134
+ url: 'http://192.168.12.106:8080/postHalo', //仅为示例,并非真实接口地址。
135
+ complete: ()=> {}
136
+ });
137
+ requestTask.abort();
138
+ ```
139
+ */
140
+ abort(): void
141
+ }
142
+
143
+
144
+ //===============================上传==================================
145
+
146
+
147
+ export type UploadFile = (options: UploadFileOptions) => UploadTask | null;
148
+ export type UploadFileOptionFiles = {
149
+ /**
150
+ * multipart 提交时,表单的项目名,默认为 file,如果 name 不填或填的值相同,可能导致服务端读取文件时只能读取到一个文件。
151
+ */
152
+ name: string | null,
153
+ /**
154
+ * 要上传文件资源的路径
155
+ */
156
+ uri: string,
157
+ /**
158
+ * 要上传的文件对象,仅H5(2.6.15+)支持
159
+ */
160
+ file: any | null
161
+ };
162
+ export type UploadFileSuccess = {
163
+ /**
164
+ * 开发者服务器返回的数据
165
+ */
166
+ data: string,
167
+ /**
168
+ * 开发者服务器返回的 HTTP 状态码
169
+ */
170
+ statusCode: number
171
+ };
172
+ export type UploadFileSuccessCallback = (result: UploadFileSuccess) => void;
173
+ export type UploadFileFail = {
174
+ /**
175
+ * 错误信息
176
+ */
177
+ errMsg: string,
178
+ /**
179
+ * 错误码
180
+ */
181
+ errCode: number,
182
+ /**
183
+ * 调用API的名称
184
+ */
185
+ errSubject: string,
186
+ /**
187
+ * 错误来源
188
+ */
189
+ cause?: any
190
+ };
191
+ export type UploadFileFailCallback = (result: UploadFileFail) => void;
192
+
193
+ export type UploadFileCompleteCallback = (result: any) => void;
194
+ export type UploadFileOptions = {
195
+ /**
196
+ * 开发者服务器 url
197
+ */
198
+ url: string,
199
+ /**
200
+ * 要上传文件资源的路径
201
+ */
202
+ filePath: string | null,
203
+ /**
204
+ * 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容
205
+ */
206
+ name: string | null,
207
+ /**
208
+ * 需要上传的文件列表。
209
+ */
210
+ files: (UploadFileOptionFiles[]) | null,
211
+ /**
212
+ * HTTP 请求 Header, header 中不能设置 Referer
213
+ */
214
+ header: UTSJSONObject | null,
215
+ /**
216
+ * HTTP 请求中其他额外的 form data
217
+ */
218
+ formData: UTSJSONObject | null,
219
+ /**
220
+ * 超时时间,单位 ms
221
+ */
222
+ timeout: number | null,
223
+ /**
224
+ * 成功返回的回调函数
225
+ */
226
+ success: UploadFileSuccessCallback | null,
227
+ /**
228
+ * 失败的回调函数
229
+ */
230
+ fail: UploadFileFailCallback | null,
231
+ /**
232
+ * 结束的回调函数(调用成功、失败都会执行)
233
+ */
234
+ complete: UploadFileCompleteCallback | null
235
+ };
236
+ export type OnProgressUpdateResult = {
237
+ /**
238
+ * 上传进度百分比
239
+ */
240
+ progress: number,
241
+ /**
242
+ * 已经上传的数据长度,单位 Bytes
243
+ */
244
+ totalBytesSent: number,
245
+ /**
246
+ * 预期需要上传的数据总长度,单位 Bytes
247
+ */
248
+ totalBytesExpectedToSend: number
249
+ };
250
+
251
+ export type UploadFileProgressUpdateCallback = (result: OnProgressUpdateResult) => void
252
+ export interface UploadTask {
253
+ /**
254
+ * abort()
255
+ * @description
256
+ * 中断上传任务。
257
+ * @param {void}
258
+ * @return {void}
259
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
260
+ * @uniPlatform {
261
+ * "app": {
262
+ * "android": {
263
+ * "osVer": "4.4",
264
+ * "uniVer": "√",
265
+ * "unixVer": "3.9.0"
266
+ * },
267
+ * "ios": {
268
+ * "osVer": "9.0",
269
+ * "uniVer": "√",
270
+ * "unixVer": "3.9.0"
271
+ * }
272
+ * }
273
+ * }
274
+ * @example
275
+ ```typescript
276
+ var uploadTask = uni.uploadFile({
277
+ url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,并非真实接口地址。
278
+ complete: ()=> {}
279
+ });
280
+ uploadTask.abort();
281
+ ```
282
+ */
283
+ abort(): void,
284
+ /**
285
+ * onProgressUpdate()
286
+ * @description
287
+ * 监听上传进度变化。
288
+ * @param {UploadFileProgressUpdateCallback} callback
289
+ * @return {void}
290
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
291
+ * @uniPlatform {
292
+ * "app": {
293
+ * "android": {
294
+ * "osVer": "4.4",
295
+ * "uniVer": "√",
296
+ * "unixVer": "3.9.0"
297
+ * },
298
+ * "ios": {
299
+ * "osVer": "9.0",
300
+ * "uniVer": "√",
301
+ * "unixVer": "3.9.0"
302
+ * }
303
+ * }
304
+ * }
305
+ * @example
306
+ ```typescript
307
+ uploadTask.onProgressUpdate((res) => {
308
+ console.log('上传进度' + res.progress);
309
+ console.log('已经上传的数据长度' + res.totalBytesSent);
310
+ console.log('预期需要上传的数据总长度' + res.totalBytesExpectedToSend);
311
+ });
312
+ ```
313
+ */
314
+ onProgressUpdate(callback: UploadFileProgressUpdateCallback): void,
315
+ };
316
+
317
+ //===============================下载==================================
318
+
319
+ export type DownloadFile = (options: DownloadFileOptions) => DownloadTask | null;
320
+ export type DownloadFileSuccess = {
321
+ /**
322
+ * 临时文件路径,下载后的文件会存储到一个临时文件
323
+ */
324
+ tempFilePath: string,
325
+ /**
326
+ * 开发者服务器返回的 HTTP 状态码
327
+ */
328
+ statusCode: number
329
+ };
330
+ export type DownloadFileSuccessCallback = (result: DownloadFileSuccess) => void;
331
+ export type DownloadFileFail = {
332
+ errSubject: string,
333
+ errCode: number,
334
+ errMsg: string,
335
+ data: object | null,
336
+ cause: any | null
337
+ };
338
+ export type DownloadFileFailCallback = (result: DownloadFileFail) => void;
339
+ export type DownloadFileComplete = any;
340
+ export type DownloadFileCompleteCallback = (result: DownloadFileComplete) => void;
341
+ export type DownloadFileOptions = {
342
+ /**
343
+ * 下载资源的 url
344
+ */
345
+ url: string,
346
+ /**
347
+ * HTTP 请求 Header,header 中不能设置 Referer
348
+ */
349
+ header: UTSJSONObject | null,
350
+ /**
351
+ * 超时时间,单位 ms
352
+ */
353
+ timeout: number | null,
354
+ /**
355
+ * 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'}
356
+ */
357
+ success: DownloadFileSuccessCallback | null,
358
+ /**
359
+ * 失败的回调函数
360
+ */
361
+ fail: DownloadFileFailCallback | null,
362
+ /**
363
+ * 结束的回调函数(调用成功、失败都会执行)
364
+ */
365
+ complete: DownloadFileCompleteCallback | null
366
+ };
367
+ export type OnProgressDownloadResult = {
368
+ /**
369
+ * 下载进度百分比
370
+ */
371
+ progress: number,
372
+ /**
373
+ * 已经下载的数据长度,单位 Bytes
374
+ */
375
+ totalBytesWritten: number,
376
+ /**
377
+ * 预期需要下载的数据总长度,单位 Bytes
378
+ */
379
+ totalBytesExpectedToWrite: number
380
+ };
381
+ export type DownloadFileProgressUpdateCallback = (result: OnProgressDownloadResult) => void;
382
+ export interface DownloadTask {
383
+ /**
384
+ * abort()
385
+ * @description
386
+ * 中断下载任务。
387
+ * @param {void}
388
+ * @return {void}
389
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
390
+ * @uniPlatform {
391
+ * "app": {
392
+ * "android": {
393
+ * "osVer": "4.4",
394
+ * "uniVer": "√",
395
+ * "unixVer": "3.9.0"
396
+ * },
397
+ * "ios": {
398
+ * "osVer": "9.0",
399
+ * "uniVer": "√",
400
+ * "unixVer": "3.9.0"
401
+ * }
402
+ * }
403
+ * }
404
+ * @example
405
+ ```typescript
406
+ var downloadTask = uni.downloadFile({
407
+ url: 'https://www.example.com/file/test', //仅为示例,并非真实接口地址。
408
+ complete: ()=> {}
409
+ });
410
+ downloadTask.abort();
411
+ ```
412
+ */
413
+ abort(): void,
414
+ /**
415
+ * onProgressUpdate()
416
+ * @description
417
+ * 监听下载进度变化。
418
+ * @param {DownloadFileProgressUpdateCallback} callback
419
+ * @return {void}
420
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
421
+ * @uniPlatform {
422
+ * "app": {
423
+ * "android": {
424
+ * "osVer": "4.4",
425
+ * "uniVer": "√",
426
+ * "unixVer": "3.9.0"
427
+ * },
428
+ * "ios": {
429
+ * "osVer": "9.0",
430
+ * "uniVer": "√",
431
+ * "unixVer": "3.9.0"
432
+ * }
433
+ * }
434
+ * }
435
+ * @example
436
+ ```typescript
437
+ downloadTask.onProgressUpdate((res) => {
438
+ console.log('下载进度' + res.progress);
439
+ console.log('已经下载的数据长度' + res.totalBytesWritten);
440
+ console.log('预期需要下载的数据总长度' + res.totalBytesExpectedToWrite);
441
+ });
442
+ ```
443
+ */
444
+ onProgressUpdate(callback: DownloadFileProgressUpdateCallback): void,
445
+ };
446
+
447
+
448
+ export interface Uni {
449
+ /**
450
+ * Request()
451
+ * @description
452
+ * 发起网络请求。
453
+ * @param {RequestOptions} options
454
+ * @return {RequestTask | null}
455
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/request.html
456
+ * @uniPlatform {
457
+ * "app": {
458
+ * "android": {
459
+ * "osVer": "4.4",
460
+ * "uniVer": "√",
461
+ * "unixVer": "3.9.0"
462
+ * },
463
+ * "ios": {
464
+ * "osVer": "9.0",
465
+ * "uniVer": "√",
466
+ * "unixVer": "3.9.0"
467
+ * }
468
+ * }
469
+ * }
470
+ * @example
471
+ ```typescript
472
+ uni.request({
473
+ url: "http://192.168.12.106:8080/postHalo",
474
+ dataType: "json",
475
+ responseType: "json",
476
+ method: "POST",
477
+ data: {
478
+ platform: "ios",
479
+ },
480
+ // header: {
481
+ // "Content-Type": "application/json",
482
+ // },
483
+ timeout: 6000,
484
+ sslVerify: false,
485
+ withCredentials: false,
486
+ firstIpv4: false,
487
+ success(res) {
488
+ console.log("success :", res.data);
489
+ },
490
+ fail(e) {
491
+ console.log(e);
492
+ },
493
+ complete(res) {
494
+ console.log("complete :", res);
495
+ },
496
+ });
497
+ ```
498
+ */
499
+ request: Request,
500
+ /**
501
+ * UploadFile()
502
+ * @description
503
+ * 将本地资源上传到开发者服务器。
504
+ * @param {UploadFileOptions} options
505
+ * @return {UploadTask | null}
506
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
507
+ * @uniPlatform {
508
+ * "app": {
509
+ * "android": {
510
+ * "osVer": "4.4",
511
+ * "uniVer": "√",
512
+ * "unixVer": "3.9.0"
513
+ * },
514
+ * "ios": {
515
+ * "osVer": "9.0",
516
+ * "uniVer": "√",
517
+ * "unixVer": "3.9.0"
518
+ * }
519
+ * }
520
+ * }
521
+ * @example
522
+ ```typescript
523
+ uni.uploadFile({
524
+ url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,非真实的接口地址
525
+ filePath: "/static/logo.png",
526
+ name: 'file',
527
+ formData: {
528
+ 'user': 'test'
529
+ },
530
+ success: (uploadFileRes) => {
531
+ console.log(uploadFileRes.data);
532
+ }
533
+ });
534
+ ```
535
+ */
536
+ uploadFile: UploadFile,
537
+ /**
538
+ * DownloadFile()
539
+ * @description
540
+ * 下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。
541
+ * @param {DownloadFileOptions} options
542
+ * @return {DownloadTask | null}
543
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
544
+ * @uniPlatform {
545
+ * "app": {
546
+ * "android": {
547
+ * "osVer": "4.4",
548
+ * "uniVer": "√",
549
+ * "unixVer": "3.9.0"
550
+ * },
551
+ * "ios": {
552
+ * "osVer": "9.0",
553
+ * "uniVer": "√",
554
+ * "unixVer": "3.9.0"
555
+ * }
556
+ * }
557
+ * }
558
+ * @example
559
+ ```typescript
560
+ uni.downloadFile({
561
+ url: "http://192.168.12.106:8080/downloadfile",
562
+ success(e) {
563
+ console.log("success111 :", e);
564
+ }
565
+ });
566
+ ```
567
+ */
568
+ downloadFile: DownloadFile
569
+ }
@@ -0,0 +1,23 @@
1
+ import {
2
+ OpenAppAuthorizeSetting as OpenAppAuthorizeSettingOrigin,
3
+ OpenAppAuthorizeSettingSuccess as OpenAppAuthorizeSettingSuccessOrigin,
4
+ OpenAppAuthorizeSettingSuccessCallback as OpenAppAuthorizeSettingSuccessCallbackOrigin,
5
+ OpenAppAuthorizeSettingFail as OpenAppAuthorizeSettingFailOrigin,
6
+ OpenAppAuthorizeSettingFailCallback as OpenAppAuthorizeSettingFailCallbackOrigin,
7
+ OpenAppAuthorizeSettingComplete as OpenAppAuthorizeSettingCompleteOrigin,
8
+ OpenAppAuthorizeSettingCompleteCallback as OpenAppAuthorizeSettingCompleteCallbackOrigin,
9
+ OpenAppAuthorizeSettingOptions as OpenAppAuthorizeSettingOptionsOrigin,
10
+ Uni as UniOrigin
11
+ } from './interface'
12
+
13
+ declare global {
14
+ type OpenAppAuthorizeSetting = OpenAppAuthorizeSettingOrigin
15
+ type OpenAppAuthorizeSettingSuccess = OpenAppAuthorizeSettingSuccessOrigin
16
+ type OpenAppAuthorizeSettingSuccessCallback = OpenAppAuthorizeSettingSuccessCallbackOrigin
17
+ type OpenAppAuthorizeSettingFail = OpenAppAuthorizeSettingFailOrigin
18
+ type OpenAppAuthorizeSettingFailCallback = OpenAppAuthorizeSettingFailCallbackOrigin
19
+ type OpenAppAuthorizeSettingComplete = OpenAppAuthorizeSettingCompleteOrigin
20
+ type OpenAppAuthorizeSettingCompleteCallback = OpenAppAuthorizeSettingCompleteCallbackOrigin
21
+ type OpenAppAuthorizeSettingOptions = OpenAppAuthorizeSettingOptionsOrigin
22
+ interface Uni extends UniOrigin { }
23
+ }