@dcloudio/uni-app-x 0.7.21 → 0.7.23

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 (337) hide show
  1. package/.prettierrc +5 -5
  2. package/README.md +1 -1
  3. package/index.d.ts +1 -1
  4. package/options.d.ts +9 -9
  5. package/package.json +27 -27
  6. package/types/app.d.ts +1002 -1002
  7. package/types/index.d.ts +7 -7
  8. package/types/native/AsyncApiResult.d.ts +7 -7
  9. package/types/native/CSSStyleDeclaration.d.ts +25 -25
  10. package/types/native/CanvasRenderingContext2D.d.ts +3634 -2048
  11. package/types/native/DOMRect.d.ts +56 -56
  12. package/types/native/DrawableContext.d.ts +162 -162
  13. package/types/native/INavigationBar.d.ts +22 -22
  14. package/types/native/IUniElement.d.ts +2928 -2859
  15. package/types/native/IUniError.d.ts +20 -20
  16. package/types/native/IUniForm.d.ts +9 -9
  17. package/types/native/{IUniObjectElement.d.ts → IUniNativeViewElement.d.ts} +124 -124
  18. package/types/native/NativeLoadFontFaceOptions.d.ts +11 -11
  19. package/types/native/NodeData.d.ts +22 -22
  20. package/types/native/PageNode.d.ts +6 -6
  21. package/types/native/Path2D.d.ts +269 -241
  22. package/types/native/SnapshotOptions.d.ts +63 -63
  23. package/types/native/SourceError.d.ts +46 -46
  24. package/types/native/UTSAndroidHookProxy.d.ts +14 -14
  25. package/types/native/UniAggregateError.d.ts +19 -19
  26. package/types/native/UniApp.d.ts +205 -205
  27. package/types/native/UniCallbackWrapper.d.ts +7 -7
  28. package/types/native/UniCanvasElement.d.ts +9 -9
  29. package/types/native/UniCustomEvent.d.ts +24 -24
  30. package/types/native/UniDocument.d.ts +83 -83
  31. package/types/native/UniElement.d.ts +79 -79
  32. package/types/native/UniError.d.ts +70 -70
  33. package/types/native/UniEvent.d.ts +92 -92
  34. package/types/native/UniFormControl.d.ts +8 -8
  35. package/types/native/UniFormControlElement.d.ts +14 -14
  36. package/types/native/UniImageErrorEvent.d.ts +33 -33
  37. package/types/native/UniImageLoadEvent.d.ts +37 -37
  38. package/types/native/UniInputBlurEvent.d.ts +36 -36
  39. package/types/native/UniInputConfirmEvent.d.ts +30 -30
  40. package/types/native/UniInputEvent.d.ts +38 -38
  41. package/types/native/UniInputFocusEvent.d.ts +53 -53
  42. package/types/native/UniNativePage.d.ts +270 -270
  43. package/types/native/UniNestedPreScrollEvent.d.ts +45 -45
  44. package/types/native/UniPageEvent.d.ts +10 -10
  45. package/types/native/UniPageManager.d.ts +27 -27
  46. package/types/native/UniPageScrollEvent.d.ts +13 -13
  47. package/types/native/UniPointerEvent.d.ts +74 -74
  48. package/types/native/UniProvider.d.ts +32 -15
  49. package/types/native/UniRefresherEvent.d.ts +18 -18
  50. package/types/native/UniResizeEvent.d.ts +34 -34
  51. package/types/native/UniResizeObserver.d.ts +184 -184
  52. package/types/native/UniRichTextItemClickEvent.d.ts +41 -41
  53. package/types/native/UniScrollEvent.d.ts +42 -42
  54. package/types/native/UniScrollToLowerEvent.d.ts +23 -23
  55. package/types/native/UniScrollToUpperEvent.d.ts +23 -23
  56. package/types/native/UniStartNestedScrollEvent.d.ts +33 -33
  57. package/types/native/UniStopNestedScrollEvent.d.ts +28 -28
  58. package/types/native/UniSwiperAnimationFinishEvent.d.ts +44 -44
  59. package/types/native/UniSwiperChangeEvent.d.ts +44 -44
  60. package/types/native/UniSwiperTransitionEvent.d.ts +24 -24
  61. package/types/native/UniTabTapEvent.d.ts +18 -18
  62. package/types/native/UniTabsElement.d.ts +59 -59
  63. package/types/native/UniTextElement.d.ts +34 -34
  64. package/types/native/UniTextareaFocusEvent.d.ts +54 -54
  65. package/types/native/UniTouchEvent.d.ts +64 -64
  66. package/types/native/UniVideoElement.d.ts +83 -75
  67. package/types/native/UniWebViewDownloadEvent.d.ts +52 -52
  68. package/types/native/UniWebViewElement.d.ts +10 -10
  69. package/types/native/UniWebViewErrorEvent.d.ts +59 -59
  70. package/types/native/UniWebViewLoadEvent.d.ts +41 -41
  71. package/types/native/UniWebViewLoadingEvent.d.ts +41 -41
  72. package/types/native/UniWebViewMessageEvent.d.ts +36 -36
  73. package/types/native/UniWebViewServiceMessageEvent.d.ts +8 -8
  74. package/types/native/ViewToTempFilePathOptions.d.ts +47 -47
  75. package/types/native/WebViewStyles.d.ts +20 -20
  76. package/types/native/global.d.ts +616 -598
  77. package/types/native/index.d.ts +71 -71
  78. package/types/native-global/index.d.ts +1 -1
  79. package/types/page.d.ts +1682 -1682
  80. package/types/process.d.ts +5 -5
  81. package/types/uni/base/index.d.ts +3 -3
  82. package/types/uni/env/index.d.ts +103 -103
  83. package/types/uni/global.d.ts +6 -6
  84. package/types/uni/index.d.ts +4 -4
  85. package/types/uni/uts-plugin-api/global.d.ts +58 -58
  86. package/types/uni/uts-plugin-api/index.d.ts +58 -58
  87. package/types/uni/uts-plugin-api/lib/uni-addPhoneContact/utssdk/global.d.ts +26 -26
  88. package/types/uni/uts-plugin-api/lib/uni-addPhoneContact/utssdk/index.d.ts +12 -12
  89. package/types/uni/uts-plugin-api/lib/uni-addPhoneContact/utssdk/interface.d.ts +231 -231
  90. package/types/uni/uts-plugin-api/lib/uni-arrayBufferToBase64/utssdk/global.d.ts +10 -10
  91. package/types/uni/uts-plugin-api/lib/uni-arrayBufferToBase64/utssdk/index.d.ts +4 -4
  92. package/types/uni/uts-plugin-api/lib/uni-arrayBufferToBase64/utssdk/interface.d.ts +77 -77
  93. package/types/uni/uts-plugin-api/lib/uni-authentication/utssdk/global.d.ts +60 -60
  94. package/types/uni/uts-plugin-api/lib/uni-authentication/utssdk/index.d.ts +29 -29
  95. package/types/uni/uts-plugin-api/lib/uni-authentication/utssdk/interface.d.ts +171 -161
  96. package/types/uni/uts-plugin-api/lib/uni-base64ToArrayBuffer/utssdk/global.d.ts +10 -10
  97. package/types/uni/uts-plugin-api/lib/uni-base64ToArrayBuffer/utssdk/index.d.ts +4 -4
  98. package/types/uni/uts-plugin-api/lib/uni-base64ToArrayBuffer/utssdk/interface.d.ts +77 -77
  99. package/types/uni/uts-plugin-api/lib/uni-canvas/utssdk/global.d.ts +22 -20
  100. package/types/uni/uts-plugin-api/lib/uni-canvas/utssdk/index.d.ts +10 -9
  101. package/types/uni/uts-plugin-api/lib/uni-canvas/utssdk/interface.d.ts +332 -264
  102. package/types/uni/uts-plugin-api/lib/uni-clipboard/utssdk/global.d.ts +40 -40
  103. package/types/uni/uts-plugin-api/lib/uni-clipboard/utssdk/index.d.ts +19 -19
  104. package/types/uni/uts-plugin-api/lib/uni-clipboard/utssdk/interface.d.ts +203 -203
  105. package/types/uni/uts-plugin-api/lib/uni-createInnerAudioContext/utssdk/global.d.ts +12 -12
  106. package/types/uni/uts-plugin-api/lib/uni-createInnerAudioContext/utssdk/index.d.ts +5 -5
  107. package/types/uni/uts-plugin-api/lib/uni-createInnerAudioContext/utssdk/interface.d.ts +1733 -1733
  108. package/types/uni/uts-plugin-api/lib/uni-createIntersectionObserver/utssdk/global.d.ts +20 -20
  109. package/types/uni/uts-plugin-api/lib/uni-createIntersectionObserver/utssdk/index.d.ts +9 -9
  110. package/types/uni/uts-plugin-api/lib/uni-createIntersectionObserver/utssdk/interface.d.ts +152 -152
  111. package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/global.d.ts +18 -18
  112. package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/index.d.ts +8 -8
  113. package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/interface.d.ts +61 -61
  114. package/types/uni/uts-plugin-api/lib/uni-createSelectorQuery/utssdk/global.d.ts +20 -20
  115. package/types/uni/uts-plugin-api/lib/uni-createSelectorQuery/utssdk/index.d.ts +9 -9
  116. package/types/uni/uts-plugin-api/lib/uni-createSelectorQuery/utssdk/interface.d.ts +464 -464
  117. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/global.d.ts +12 -12
  118. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/index.d.ts +5 -5
  119. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/interface.d.ts +137 -137
  120. package/types/uni/uts-plugin-api/lib/uni-dialogPage/utssdk/global.d.ts +28 -28
  121. package/types/uni/uts-plugin-api/lib/uni-dialogPage/utssdk/index.d.ts +13 -13
  122. package/types/uni/uts-plugin-api/lib/uni-dialogPage/utssdk/interface.d.ts +1400 -1336
  123. package/types/uni/uts-plugin-api/lib/uni-event/utssdk/global.d.ts +16 -16
  124. package/types/uni/uts-plugin-api/lib/uni-event/utssdk/index.d.ts +7 -7
  125. package/types/uni/uts-plugin-api/lib/uni-event/utssdk/interface.d.ts +305 -305
  126. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/global.d.ts +26 -26
  127. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/index.d.ts +12 -12
  128. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/interface.d.ts +97 -91
  129. package/types/uni/uts-plugin-api/lib/uni-file/utssdk/global.d.ts +80 -80
  130. package/types/uni/uts-plugin-api/lib/uni-file/utssdk/index.d.ts +39 -39
  131. package/types/uni/uts-plugin-api/lib/uni-file/utssdk/interface.d.ts +174 -174
  132. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/global.d.ts +142 -142
  133. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/index.d.ts +70 -70
  134. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/interface.d.ts +1881 -1840
  135. package/types/uni/uts-plugin-api/lib/uni-getAccessibilityInfo/utssdk/global.d.ts +10 -10
  136. package/types/uni/uts-plugin-api/lib/uni-getAccessibilityInfo/utssdk/index.d.ts +4 -4
  137. package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/global.d.ts +12 -12
  138. package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/index.d.ts +5 -5
  139. package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/interface.d.ts +455 -329
  140. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/global.d.ts +14 -14
  141. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/index.d.ts +6 -6
  142. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +818 -818
  143. package/types/uni/uts-plugin-api/lib/uni-getBackgroundAudioManager/utssdk/global.d.ts +12 -12
  144. package/types/uni/uts-plugin-api/lib/uni-getBackgroundAudioManager/utssdk/index.d.ts +5 -5
  145. package/types/uni/uts-plugin-api/lib/uni-getBackgroundAudioManager/utssdk/interface.d.ts +297 -297
  146. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/global.d.ts +14 -14
  147. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/index.d.ts +6 -6
  148. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/interface.d.ts +657 -657
  149. package/types/uni/uts-plugin-api/lib/uni-getElementById/utssdk/global.d.ts +10 -10
  150. package/types/uni/uts-plugin-api/lib/uni-getElementById/utssdk/index.d.ts +4 -4
  151. package/types/uni/uts-plugin-api/lib/uni-getElementById/utssdk/interface.d.ts +81 -81
  152. package/types/uni/uts-plugin-api/lib/uni-getEnterOptionsSync/utssdk/global.d.ts +12 -12
  153. package/types/uni/uts-plugin-api/lib/uni-getEnterOptionsSync/utssdk/index.d.ts +5 -5
  154. package/types/uni/uts-plugin-api/lib/uni-getEnterOptionsSync/utssdk/interface.d.ts +155 -155
  155. package/types/uni/uts-plugin-api/lib/uni-getLaunchOptionsSync/utssdk/global.d.ts +12 -12
  156. package/types/uni/uts-plugin-api/lib/uni-getLaunchOptionsSync/utssdk/index.d.ts +5 -5
  157. package/types/uni/uts-plugin-api/lib/uni-getLaunchOptionsSync/utssdk/interface.d.ts +159 -159
  158. package/types/uni/uts-plugin-api/lib/uni-getLocation/utssdk/global.d.ts +24 -24
  159. package/types/uni/uts-plugin-api/lib/uni-getLocation/utssdk/index.d.ts +11 -11
  160. package/types/uni/uts-plugin-api/lib/uni-getLocation/utssdk/interface.d.ts +1008 -563
  161. package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/global.d.ts +8 -8
  162. package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/index.d.ts +4 -4
  163. package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/interface.d.ts +1 -1
  164. package/types/uni/uts-plugin-api/lib/uni-getLocation-tencent/utssdk/global.d.ts +8 -8
  165. package/types/uni/uts-plugin-api/lib/uni-getLocation-tencent/utssdk/index.d.ts +4 -4
  166. package/types/uni/uts-plugin-api/lib/uni-getNetworkType/utssdk/global.d.ts +32 -32
  167. package/types/uni/uts-plugin-api/lib/uni-getNetworkType/utssdk/index.d.ts +15 -15
  168. package/types/uni/uts-plugin-api/lib/uni-getPerformance/utssdk/global.d.ts +22 -22
  169. package/types/uni/uts-plugin-api/lib/uni-getPerformance/utssdk/index.d.ts +10 -10
  170. package/types/uni/uts-plugin-api/lib/uni-getPerformance/utssdk/interface.d.ts +163 -163
  171. package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/global.d.ts +36 -30
  172. package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/index.d.ts +17 -14
  173. package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/interface.d.ts +521 -375
  174. package/types/uni/uts-plugin-api/lib/uni-getRecorderManager/utssdk/global.d.ts +16 -16
  175. package/types/uni/uts-plugin-api/lib/uni-getRecorderManager/utssdk/index.d.ts +7 -7
  176. package/types/uni/uts-plugin-api/lib/uni-getRecorderManager/utssdk/interface.d.ts +980 -980
  177. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/global.d.ts +30 -30
  178. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/index.d.ts +14 -14
  179. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/interface.d.ts +2138 -2131
  180. package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/global.d.ts +12 -12
  181. package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/index.d.ts +5 -5
  182. package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/interface.d.ts +207 -169
  183. package/types/uni/uts-plugin-api/lib/uni-installApk/utssdk/global.d.ts +24 -24
  184. package/types/uni/uts-plugin-api/lib/uni-installApk/utssdk/index.d.ts +11 -11
  185. package/types/uni/uts-plugin-api/lib/uni-interceptor/utssdk/global.d.ts +16 -16
  186. package/types/uni/uts-plugin-api/lib/uni-interceptor/utssdk/index.d.ts +7 -7
  187. package/types/uni/uts-plugin-api/lib/uni-interceptor/utssdk/interface.d.ts +169 -169
  188. package/types/uni/uts-plugin-api/lib/uni-keyboard/utssdk/global.d.ts +22 -22
  189. package/types/uni/uts-plugin-api/lib/uni-keyboard/utssdk/index.d.ts +10 -10
  190. package/types/uni/uts-plugin-api/lib/uni-keyboard/utssdk/interface.d.ts +60 -60
  191. package/types/uni/uts-plugin-api/lib/uni-loadFontFace/utssdk/global.d.ts +26 -26
  192. package/types/uni/uts-plugin-api/lib/uni-loadFontFace/utssdk/index.d.ts +12 -12
  193. package/types/uni/uts-plugin-api/lib/uni-loadFontFace/utssdk/interface.d.ts +581 -564
  194. package/types/uni/uts-plugin-api/lib/uni-makePhoneCall/utssdk/global.d.ts +24 -24
  195. package/types/uni/uts-plugin-api/lib/uni-makePhoneCall/utssdk/index.d.ts +11 -11
  196. package/types/uni/uts-plugin-api/lib/uni-makePhoneCall/utssdk/interface.d.ts +100 -100
  197. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/global.d.ts +160 -160
  198. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/index.d.ts +79 -79
  199. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/interface.d.ts +1386 -1339
  200. package/types/uni/uts-plugin-api/lib/uni-navigationBar/utssdk/global.d.ts +68 -68
  201. package/types/uni/uts-plugin-api/lib/uni-navigationBar/utssdk/index.d.ts +33 -33
  202. package/types/uni/uts-plugin-api/lib/uni-navigationBar/utssdk/interface.d.ts +1002 -1002
  203. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/global.d.ts +72 -72
  204. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/index.d.ts +35 -35
  205. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/interface.d.ts +1539 -1493
  206. package/types/uni/uts-plugin-api/lib/uni-openAppAuthorizeSetting/utssdk/global.d.ts +24 -24
  207. package/types/uni/uts-plugin-api/lib/uni-openAppAuthorizeSetting/utssdk/index.d.ts +11 -11
  208. package/types/uni/uts-plugin-api/lib/uni-openDocument/utssdk/global.d.ts +24 -24
  209. package/types/uni/uts-plugin-api/lib/uni-openDocument/utssdk/index.d.ts +11 -11
  210. package/types/uni/uts-plugin-api/lib/uni-openDocument/utssdk/interface.d.ts +70 -70
  211. package/types/uni/uts-plugin-api/lib/uni-pageScrollTo/utssdk/global.d.ts +26 -26
  212. package/types/uni/uts-plugin-api/lib/uni-pageScrollTo/utssdk/index.d.ts +12 -12
  213. package/types/uni/uts-plugin-api/lib/uni-pageScrollTo/utssdk/interface.d.ts +153 -153
  214. package/types/uni/uts-plugin-api/lib/uni-payment/utssdk/global.d.ts +32 -32
  215. package/types/uni/uts-plugin-api/lib/uni-payment/utssdk/index.d.ts +15 -15
  216. package/types/uni/uts-plugin-api/lib/uni-payment/utssdk/interface.d.ts +527 -240
  217. package/types/uni/uts-plugin-api/lib/uni-payment-alipay/utssdk/global.d.ts +8 -8
  218. package/types/uni/uts-plugin-api/lib/uni-payment-alipay/utssdk/index.d.ts +4 -4
  219. package/types/uni/uts-plugin-api/lib/uni-payment-wxpay/utssdk/global.d.ts +8 -8
  220. package/types/uni/uts-plugin-api/lib/uni-payment-wxpay/utssdk/index.d.ts +4 -4
  221. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/global.d.ts +78 -78
  222. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/index.d.ts +38 -38
  223. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/interface.d.ts +213 -21
  224. package/types/uni/uts-plugin-api/lib/uni-pullDownRefresh/utssdk/global.d.ts +28 -28
  225. package/types/uni/uts-plugin-api/lib/uni-pullDownRefresh/utssdk/index.d.ts +13 -13
  226. package/types/uni/uts-plugin-api/lib/uni-pullDownRefresh/utssdk/interface.d.ts +189 -189
  227. package/types/uni/uts-plugin-api/lib/uni-route/utssdk/global.d.ts +58 -58
  228. package/types/uni/uts-plugin-api/lib/uni-route/utssdk/index.d.ts +28 -28
  229. package/types/uni/uts-plugin-api/lib/uni-route/utssdk/interface.d.ts +2695 -2165
  230. package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/global.d.ts +10 -10
  231. package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/index.d.ts +4 -4
  232. package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/interface.d.ts +38 -38
  233. package/types/uni/uts-plugin-api/lib/uni-scanCode/utssdk/global.d.ts +24 -24
  234. package/types/uni/uts-plugin-api/lib/uni-scanCode/utssdk/index.d.ts +11 -11
  235. package/types/uni/uts-plugin-api/lib/uni-scanCode/utssdk/interface.d.ts +73 -73
  236. package/types/uni/uts-plugin-api/lib/uni-shareWithSystem/utssdk/global.d.ts +22 -0
  237. package/types/uni/uts-plugin-api/lib/uni-shareWithSystem/utssdk/index.d.ts +10 -0
  238. package/types/uni/uts-plugin-api/lib/uni-shareWithSystem/utssdk/interface.d.ts +120 -0
  239. package/types/uni/uts-plugin-api/lib/uni-storage/utssdk/global.d.ts +78 -78
  240. package/types/uni/uts-plugin-api/lib/uni-storage/utssdk/index.d.ts +38 -38
  241. package/types/uni/uts-plugin-api/lib/uni-storage/utssdk/interface.d.ts +600 -600
  242. package/types/uni/uts-plugin-api/lib/uni-tabBar/utssdk/global.d.ts +148 -148
  243. package/types/uni/uts-plugin-api/lib/uni-tabBar/utssdk/index.d.ts +73 -73
  244. package/types/uni/uts-plugin-api/lib/uni-tabBar/utssdk/interface.d.ts +1106 -1086
  245. package/types/uni/uts-plugin-api/lib/uni-theme/utssdk/global.d.ts +42 -42
  246. package/types/uni/uts-plugin-api/lib/uni-theme/utssdk/index.d.ts +20 -20
  247. package/types/uni/uts-plugin-api/lib/uni-virtualPayment/utssdk/global.d.ts +112 -112
  248. package/types/uni/uts-plugin-api/lib/uni-virtualPayment/utssdk/index.d.ts +55 -55
  249. package/types/uni/uts-plugin-api/lib/uni-virtualPayment/utssdk/interface.d.ts +766 -364
  250. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/global.d.ts +58 -58
  251. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/index.d.ts +28 -28
  252. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/interface.d.ts +854 -844
  253. package/types/uni/uts-plugin-biz/global.d.ts +4 -4
  254. package/types/uni/uts-plugin-biz/index.d.ts +4 -4
  255. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/global.d.ts +36 -36
  256. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/index.d.ts +17 -17
  257. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/interface.d.ts +141 -141
  258. package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/global.d.ts +28 -28
  259. package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/index.d.ts +13 -13
  260. package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/interface.d.ts +160 -160
  261. package/types/uni/uts-plugin-biz/lib/uni-push/utssdk/global.d.ts +60 -60
  262. package/types/uni/uts-plugin-biz/lib/uni-push/utssdk/index.d.ts +29 -29
  263. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/global.d.ts +46 -46
  264. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/index.d.ts +22 -22
  265. package/types/uni/uts-plugin-biz/lib/uni-verify/utssdk/interface.d.ts +207 -207
  266. package/types/uni/uts-plugin-component/global.d.ts +1 -1
  267. package/types/uni/uts-plugin-component/index.d.ts +1 -1
  268. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/global.d.ts +64 -64
  269. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/index.d.ts +31 -31
  270. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/interface.d.ts +522 -522
  271. package/types/uni/uts-plugin-extend/README.md +3 -3
  272. package/types/uni/uts-plugin-extend/global.d.ts +14 -14
  273. package/types/uni/uts-plugin-extend/index.d.ts +14 -14
  274. package/types/uni/uts-plugin-extend/lib/uni-accelerometer/utssdk/global.d.ts +12 -12
  275. package/types/uni/uts-plugin-extend/lib/uni-accelerometer/utssdk/index.d.ts +1 -1
  276. package/types/uni/uts-plugin-extend/lib/uni-accelerometer/utssdk/interface.d.ts +365 -365
  277. package/types/uni/uts-plugin-extend/lib/uni-canvas/utssdk/global.d.ts +23 -23
  278. package/types/uni/uts-plugin-extend/lib/uni-canvas/utssdk/index.d.ts +10 -10
  279. package/types/uni/uts-plugin-extend/lib/uni-canvas/utssdk/interface.d.ts +710 -710
  280. package/types/uni/uts-plugin-extend/lib/uni-chooseLocation/utssdk/global.d.ts +21 -21
  281. package/types/uni/uts-plugin-extend/lib/uni-chooseLocation/utssdk/index.d.ts +9 -9
  282. package/types/uni/uts-plugin-extend/lib/uni-chooseLocation/utssdk/interface.d.ts +151 -151
  283. package/types/uni/uts-plugin-extend/lib/uni-compass/utssdk/global.d.ts +25 -25
  284. package/types/uni/uts-plugin-extend/lib/uni-compass/utssdk/index.d.ts +11 -11
  285. package/types/uni/uts-plugin-extend/lib/uni-compass/utssdk/interface.d.ts +363 -363
  286. package/types/uni/uts-plugin-extend/lib/uni-createInnerAudioContext/utssdk/global.d.ts +11 -11
  287. package/types/uni/uts-plugin-extend/lib/uni-createInnerAudioContext/utssdk/index.d.ts +4 -4
  288. package/types/uni/uts-plugin-extend/lib/uni-createInnerAudioContext/utssdk/interface.d.ts +224 -224
  289. package/types/uni/uts-plugin-extend/lib/uni-createMapContext/utssdk/global.d.ts +53 -53
  290. package/types/uni/uts-plugin-extend/lib/uni-createMapContext/utssdk/index.d.ts +25 -25
  291. package/types/uni/uts-plugin-extend/lib/uni-createMapContext/utssdk/interface.d.ts +487 -487
  292. package/types/uni/uts-plugin-extend/lib/uni-createMediaQueryObserver/utssdk/global.d.ts +13 -13
  293. package/types/uni/uts-plugin-extend/lib/uni-createMediaQueryObserver/utssdk/index.d.ts +5 -5
  294. package/types/uni/uts-plugin-extend/lib/uni-createMediaQueryObserver/utssdk/interface.d.ts +126 -126
  295. package/types/uni/uts-plugin-extend/lib/uni-getBackgroundAudioManager/utssdk/global.d.ts +7 -7
  296. package/types/uni/uts-plugin-extend/lib/uni-getBackgroundAudioManager/utssdk/index.d.ts +1 -1
  297. package/types/uni/uts-plugin-extend/lib/uni-getBackgroundAudioManager/utssdk/interface.d.ts +296 -296
  298. package/types/uni/uts-plugin-extend/lib/uni-locale/utssdk/global.d.ts +15 -15
  299. package/types/uni/uts-plugin-extend/lib/uni-locale/utssdk/index.d.ts +1 -1
  300. package/types/uni/uts-plugin-extend/lib/uni-locale/utssdk/interface.d.ts +229 -229
  301. package/types/uni/uts-plugin-extend/lib/uni-localeChange/utssdk/global.d.ts +14 -14
  302. package/types/uni/uts-plugin-extend/lib/uni-localeChange/utssdk/index.d.ts +1 -1
  303. package/types/uni/uts-plugin-extend/lib/uni-localeChange/utssdk/interface.d.ts +559 -559
  304. package/types/uni/uts-plugin-extend/lib/uni-memory/utssdk/global.d.ts +9 -9
  305. package/types/uni/uts-plugin-extend/lib/uni-memory/utssdk/index.d.ts +1 -1
  306. package/types/uni/uts-plugin-extend/lib/uni-memory/utssdk/interface.d.ts +163 -163
  307. package/types/uni/uts-plugin-extend/lib/uni-openLocation/utssdk/global.d.ts +21 -21
  308. package/types/uni/uts-plugin-extend/lib/uni-openLocation/utssdk/index.d.ts +9 -9
  309. package/types/uni/uts-plugin-extend/lib/uni-openLocation/utssdk/interface.d.ts +143 -143
  310. package/types/uni/uts-plugin-extend/lib/uni-preloadPage/utssdk/global.d.ts +7 -7
  311. package/types/uni/uts-plugin-extend/lib/uni-preloadPage/utssdk/index.d.ts +1 -1
  312. package/types/uni/uts-plugin-extend/lib/uni-preloadPage/utssdk/interface.d.ts +106 -106
  313. package/types/uni/uts-plugin-extend/lib/uni-theme/utssdk/global.d.ts +9 -9
  314. package/types/uni/uts-plugin-extend/lib/uni-theme/utssdk/index.d.ts +1 -1
  315. package/types/uni/uts-plugin-extend/lib/uni-theme/utssdk/interface.d.ts +165 -165
  316. package/types/uni-cloud/index.d.ts +67 -67
  317. package/types/uni-cloud/interface.d.ts +987 -987
  318. package/types/uni-cloud/unicloud-db/index.ts +314 -314
  319. package/types/uni-global/index.d.ts +1 -1
  320. package/types/vue/CheckboxGroupChangeEvent.d.ts +41 -41
  321. package/types/vue/LifeCycle.d.ts +55 -55
  322. package/types/vue/PickerViewChangeEvent.d.ts +41 -41
  323. package/types/vue/ProgressActiveendEvent.d.ts +32 -32
  324. package/types/vue/RadioGroupChangeEvent.d.ts +41 -41
  325. package/types/vue/SliderChangeEvent.d.ts +35 -35
  326. package/types/vue/SwitchChangeEvent.d.ts +32 -32
  327. package/types/vue/UniCanvasElement.d.ts +275 -275
  328. package/types/vue/UniCloudDBElement.d.ts +217 -217
  329. package/types/vue/UniFormElement.d.ts +54 -54
  330. package/types/vue/UniNavigatorElement.d.ts +11 -11
  331. package/types/vue/global.d.ts +191 -191
  332. package/types/vue/index.d.ts +10 -10
  333. package/types/vue-global/index.d.ts +1 -1
  334. package/uts-plugin.d.ts +27 -27
  335. package/types/uni/uts-plugin-api/lib/uni-animationFrame/utssdk/global.d.ts +0 -12
  336. package/types/uni/uts-plugin-api/lib/uni-animationFrame/utssdk/index.d.ts +0 -5
  337. package/types/uni/uts-plugin-api/lib/uni-animationFrame/utssdk/interface.d.ts +0 -50
@@ -1,1493 +1,1539 @@
1
- export type Request<T> = (param: RequestOptions<T>) => RequestTask;
2
-
3
- /**
4
- * 网络请求参数
5
- */
6
- export type RequestOptions<T> = {
7
- /**
8
- * 开发者服务器接口地址
9
- *
10
- * @uniPlatform
11
- * {
12
- * "app": {
13
- * "android": {
14
- * "osVer": "5.0",
15
- * "uniVer": "√",
16
- * "unixVer": "3.9+"
17
- * },
18
- * "ios": {
19
- * "osVer": "12.0",
20
- * "uniVer": "√",
21
- * "unixVer": "4.11"
22
- * },
23
- * "harmony": {
24
- * "osVer": "3.0",
25
- * "uniVer": "4.23",
26
- * "unixVer": "x"
27
- * }
28
- * },
29
- * "web": {
30
- * "uniVer": "√",
31
- * "unixVer": "4.0"
32
- * }
33
- * }
34
- */
35
- url: string,
36
- /**
37
- * 请求的参数 在`app-android端,参数类型只能为`UTSJSONObject`或者`string`类型
38
- * @type {RequestDataOptions}
39
- * @defaultValue null
40
- * @uniPlatform
41
- * {
42
- * "app": {
43
- * "android": {
44
- * "osVer": "5.0",
45
- * "uniVer": "√",
46
- * "unixVer": "3.9+"
47
- * },
48
- * "ios": {
49
- * "osVer": "12.0",
50
- * "uniVer": "√",
51
- * "unixVer": "4.11"
52
- * },
53
- * "harmony": {
54
- * "osVer": "3.0",
55
- * "uniVer": "4.23",
56
- * "unixVer": "x"
57
- * }
58
- * },
59
- * "web": {
60
- * "uniVer": "√",
61
- * "unixVer": "4.0"
62
- * }
63
- * }
64
- */
65
- data?: any | null,
66
- /**
67
- * 设置请求的 header,header 中不能设置 Referer
68
- * @defaultValue null
69
- * @uniPlatform
70
- * {
71
- * "app": {
72
- * "android": {
73
- * "osVer": "5.0",
74
- * "uniVer": "√",
75
- * "unixVer": "3.9+"
76
- * },
77
- * "ios": {
78
- * "osVer": "12.0",
79
- * "uniVer": "√",
80
- * "unixVer": "4.11"
81
- * },
82
- * "harmony": {
83
- * "osVer": "3.0",
84
- * "uniVer": "4.23",
85
- * "unixVer": "x"
86
- * }
87
- * },
88
- * "web": {
89
- * "uniVer": "√",
90
- * "unixVer": "4.0"
91
- * }
92
- * }
93
- */
94
- header?: UTSJSONObject | null,
95
- /**
96
- * 请求方法,如果设置的值不在取值范围内,会以GET方法进行请求。
97
- * @defaultValue "GET"
98
- * @uniPlatform
99
- * {
100
- * "app": {
101
- * "android": {
102
- * "osVer": "5.0",
103
- * "uniVer": "√",
104
- * "unixVer": "3.9+"
105
- * },
106
- * "ios": {
107
- * "osVer": "12.0",
108
- * "uniVer": "√",
109
- * "unixVer": "4.11"
110
- * },
111
- * "harmony": {
112
- * "osVer": "3.0",
113
- * "uniVer": "4.23",
114
- * "unixVer": "x"
115
- * }
116
- * },
117
- * "web": {
118
- * "uniVer": "√",
119
- * "unixVer": "4.0"
120
- * }
121
- * }
122
- */
123
- method?: RequestMethod | null,
124
- /**
125
- * 超时时间,单位 ms
126
- * @defaultValue 60000
127
- * @uniPlatform
128
- * {
129
- * "app": {
130
- * "android": {
131
- * "osVer": "5.0",
132
- * "uniVer": "√",
133
- * "unixVer": "3.9+"
134
- * },
135
- * "ios": {
136
- * "osVer": "12.0",
137
- * "uniVer": "√",
138
- * "unixVer": "4.11"
139
- * }
140
- * }
141
- * }
142
- */
143
- timeout?: number | null,
144
- /**
145
- * 如果设为 json,会对返回的数据进行一次 JSON.parse,非 json 不会进行 JSON.parse
146
- * @defaultValue "json"
147
- * @deprecated 不支持
148
- * @autodoc false
149
- */
150
- dataType?: string | null,
151
- /**
152
- * 设置响应的数据类型。
153
- *
154
- * @deprecated 不支持
155
- * @autodoc false
156
- */
157
- responseType?: string | null,
158
- /**
159
- * 验证 ssl 证书
160
- *
161
- * @deprecated 不支持
162
- * @autodoc false
163
- */
164
- sslVerify?: boolean | null,
165
- /**
166
- * 跨域请求时是否携带凭证(cookies)
167
- *
168
- * @uniPlatform
169
- * {
170
- * "app": {
171
- * "android": {
172
- * "osVer": "4.4",
173
- * "uniVer": "√",
174
- * "unixVer": "x"
175
- * },
176
- * "ios": {
177
- * "osVer": "12.0",
178
- * "uniVer": "√",
179
- * "unixVer": "x"
180
- * },
181
- * "harmony": {
182
- * "osVer": "x",
183
- * "uniVer": "x",
184
- * "unixVer": "x"
185
- * }
186
- * },
187
- * "web": {
188
- * "uniVer": "√",
189
- * "unixVer": "4.0"
190
- * }
191
- * }
192
- */
193
- withCredentials?: boolean | null,
194
- /**
195
- * DNS解析时优先使用ipv4
196
- * @defaultValue false
197
- * @uniPlatform
198
- * {
199
- * "app": {
200
- * "android": {
201
- * "osVer": "5.0",
202
- * "uniVer": "√",
203
- * "unixVer": "x"
204
- * },
205
- * "ios": {
206
- * "osVer": "12.0",
207
- * "uniVer": "√",
208
- * "unixVer": "x"
209
- * },
210
- * "harmony": {
211
- * "osVer": "x",
212
- * "uniVer": "x",
213
- * "unixVer": "x"
214
- * }
215
- * },
216
- * "web": {
217
- * "uniVer": "x",
218
- * "unixVer": "x"
219
- * }
220
- * }
221
- */
222
- firstIpv4?: boolean | null,
223
- /**
224
- * 网络请求成功回调。
225
- * @defaultValue null
226
- */
227
- success?: RequestSuccessCallback<T> | null,
228
- /**
229
- * 网络请求失败回调。
230
- * @defaultValue null
231
- */
232
- fail?: RequestFailCallback | null,
233
- /**
234
- * 网络请求完成回调,成功或者失败都会调用。
235
- * @defaultValue null
236
- */
237
- complete?: RequestCompleteCallback | null
238
- }
239
-
240
- export type RequestSuccess<T> = {
241
- /**
242
- * 开发者服务器返回的数据
243
- * @type {RequestDataOptions}
244
- * @uniPlatform
245
- * {
246
- * "app": {
247
- * "android": {
248
- * "osVer": "5.0",
249
- * "uniVer": "√",
250
- * "unixVer": "3.9+"
251
- * },
252
- * "ios": {
253
- * "osVer": "12.0",
254
- * "uniVer": "√",
255
- * "unixVer": "4.11"
256
- * },
257
- * "harmony": {
258
- * "osVer": "3.0",
259
- * "uniVer": "4.23",
260
- * "unixVer": "x"
261
- * }
262
- * },
263
- * "web": {
264
- * "uniVer": "√",
265
- * "unixVer": "4.0"
266
- * }
267
- * }
268
- */
269
- data: T | null,
270
- /**
271
- * 开发者服务器返回的 HTTP 状态码
272
- * @uniPlatform
273
- * {
274
- * "app": {
275
- * "android": {
276
- * "osVer": "5.0",
277
- * "uniVer": "√",
278
- * "unixVer": "3.9+"
279
- * },
280
- * "ios": {
281
- * "osVer": "12.0",
282
- * "uniVer": "√",
283
- * "unixVer": "4.11"
284
- * },
285
- * "harmony": {
286
- * "osVer": "3.0",
287
- * "uniVer": "4.23",
288
- * "unixVer": "x"
289
- * }
290
- * },
291
- * "web": {
292
- * "uniVer": "√",
293
- * "unixVer": "4.0"
294
- * }
295
- * }
296
- */
297
- statusCode: number,
298
- /**
299
- * 开发者服务器返回的 HTTP Response Header
300
- * @uniPlatform
301
- * {
302
- * "app": {
303
- * "android": {
304
- * "osVer": "5.0",
305
- * "uniVer": "√",
306
- * "unixVer": "3.9+"
307
- * },
308
- * "ios": {
309
- * "osVer": "12.0",
310
- * "uniVer": "√",
311
- * "unixVer": "4.11"
312
- * },
313
- * "harmony": {
314
- * "osVer": "3.0",
315
- * "uniVer": "4.23",
316
- * "unixVer": "x"
317
- * }
318
- * },
319
- * "web": {
320
- * "uniVer": "√",
321
- * "unixVer": "4.0"
322
- * }
323
- * }
324
- */
325
- header: any,
326
- /**
327
- * 开发者服务器返回的 cookies,格式为字符串数组
328
- * @uniPlatform
329
- * {
330
- * "app": {
331
- * "android": {
332
- * "osVer": "5.0",
333
- * "uniVer": "√",
334
- * "unixVer": "3.9+"
335
- * },
336
- * "ios": {
337
- * "osVer": "12.0",
338
- * "uniVer": "√",
339
- * "unixVer": "4.11"
340
- * },
341
- * "harmony": {
342
- * "osVer": "3.0",
343
- * "uniVer": "4.23",
344
- * "unixVer": "x"
345
- * }
346
- * },
347
- * "web": {
348
- * "uniVer": "x",
349
- * "unixVer": "x"
350
- * }
351
- * }
352
- */
353
- cookies: Array<string>
354
- }
355
-
356
- /**
357
- * 请求方法
358
- * - GET GET方法请求一个指定资源的表示形式,使用 GET 的请求应该只被用于获取数据。
359
- * - POST POST方法用于将实体提交到指定的资源,通常导致在服务器上的状态变化或副作用。
360
- * - PUT PUT方法用有效载荷请求替换目标资源的所有当前表示。
361
- * - PATCH PATCH方法用于对资源应用部分修改。
362
- * - DELETE DELETE方法删除指定的资源。
363
- * - HEAD HEAD方法请求一个与GET请求的响应相同的响应,但没有响应体。
364
- * - OPTIONS OPTIONS 方法用于描述目标资源的通信选项。
365
- */
366
- export type RequestMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
367
-
368
- /**
369
- * 错误码
370
- * - 5 接口超时
371
- * - 1000 服务端系统错误
372
- * - 100001 json数据解析错误
373
- * - 100002 错误信息json解析失败
374
- * - 600003 网络中断
375
- * - 600008 data参数类型不合法
376
- * - 600009 URL格式不合法
377
- * - 602001 request系统错误
378
- */
379
- export type RequestErrorCode = 5 | 1000 | 100001 | 100002 | 600003 | 600008 | 600009 | 602001;
380
- /**
381
- * 网络请求失败的错误回调参数
382
- */
383
- export interface RequestFail extends IUniError{
384
- errCode: RequestErrorCode
385
- };
386
- export type RequestSuccessCallback<T> = (option: RequestSuccess<T>) => void;
387
- export type RequestFailCallback = (option: RequestFail) => void;
388
- export type RequestCompleteCallback = (option: any) => void;
389
-
390
-
391
- export interface RequestTask {
392
- /**
393
- * 中断网络请求。
394
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/request.html
395
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/request.html
396
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/request.html
397
- * @uniPlatform
398
- * {
399
- * "app": {
400
- * "android": {
401
- * "osVer": "4.4",
402
- * "uniVer": "√",
403
- * "unixVer": "3.9+"
404
- * },
405
- * "ios": {
406
- * "osVer": "12.0",
407
- * "uniVer": "√",
408
- * "unixVer": "4.11"
409
- * },
410
- * "harmony": {
411
- * "osVer": "3.0",
412
- * "uniVer": "4.23",
413
- * "unixVer": "x"
414
- * }
415
- * },
416
- * "web": {
417
- * "uniVer": "√",
418
- * "unixVer": "4.0"
419
- * }
420
- * }
421
- * @example
422
- ```typescript
423
- var requestTask = uni.request({
424
- url: 'http://192.168.12.106:8080/postHalo', //仅为示例,并非真实接口地址。
425
- complete: ()=> {}
426
- });
427
- requestTask.abort();
428
- ```
429
- */
430
- abort(): void
431
- }
432
-
433
- //===============================上传==================================
434
-
435
-
436
- export type UploadFile = (options: UploadFileOptions) => UploadTask;
437
- export type UploadFileOptionFiles = {
438
- /**
439
- * multipart 提交时,表单的项目名,默认为 file,如果 name 不填或填的值相同,可能导致服务端读取文件时只能读取到一个文件。
440
- * @defaultValue "file"
441
- * @uniPlatform
442
- * {
443
- * "app": {
444
- * "android": {
445
- * "osVer": "5.0",
446
- * "uniVer": "√",
447
- * "unixVer": "3.9+"
448
- * },
449
- * "ios": {
450
- * "osVer": "12.0",
451
- * "uniVer": "√",
452
- * "unixVer": "4.11"
453
- * },
454
- * "harmony": {
455
- * "osVer": "3.0",
456
- * "uniVer": "4.23",
457
- * "unixVer": "x"
458
- * }
459
- * },
460
- * "web": {
461
- * "uniVer": "√",
462
- * "unixVer": "4.0"
463
- * }
464
- * }
465
- */
466
- name?: string | null,
467
- /**
468
- * 要上传文件资源的路径
469
- * @uniPlatform
470
- * {
471
- * "app": {
472
- * "android": {
473
- * "osVer": "5.0",
474
- * "uniVer": "√",
475
- * "unixVer": "3.9+"
476
- * },
477
- * "ios": {
478
- * "osVer": "12.0",
479
- * "uniVer": "√",
480
- * "unixVer": "4.11"
481
- * },
482
- * "harmony": {
483
- * "osVer": "3.0",
484
- * "uniVer": "4.23",
485
- * "unixVer": "x"
486
- * }
487
- * },
488
- * "web": {
489
- * "uniVer": "x",
490
- * "unixVer": "x"
491
- * }
492
- * }
493
- */
494
- uri: string,
495
- /**
496
- * 要上传的文件对象
497
- * @uniPlatform
498
- * {
499
- * "app": {
500
- * "android": {
501
- * "osVer": "4.4",
502
- * "uniVer": "",
503
- * "unixVer": "3.9+"
504
- * },
505
- * "ios": {
506
- * "osVer": "12.0",
507
- * "uniVer": "√",
508
- * "unixVer": "4.11"
509
- * },
510
- * "harmony": {
511
- * "osVer": "x",
512
- * "uniVer": "x",
513
- * "unixVer": "x"
514
- * }
515
- * },
516
- * "web": {
517
- * "uniVer": "√",
518
- * "unixVer": "4.0"
519
- * }
520
- * }
521
- */
522
- file?: any | null
523
- };
524
- export type UploadFileSuccess = {
525
- /**
526
- * 开发者服务器返回的数据
527
- * @uniPlatform
528
- * {
529
- * "app": {
530
- * "android": {
531
- * "osVer": "5.0",
532
- * "uniVer": "√",
533
- * "unixVer": "3.9+"
534
- * },
535
- * "ios": {
536
- * "osVer": "12.0",
537
- * "uniVer": "√",
538
- * "unixVer": "4.11"
539
- * },
540
- * "harmony": {
541
- * "osVer": "3.0",
542
- * "uniVer": "4.23",
543
- * "unixVer": "x"
544
- * }
545
- * },
546
- * "web": {
547
- * "uniVer": "",
548
- * "unixVer": "4.0"
549
- * }
550
- * }
551
- */
552
- data: string,
553
- /**
554
- * 开发者服务器返回的 HTTP 状态码
555
- * @uniPlatform
556
- * {
557
- * "app": {
558
- * "android": {
559
- * "osVer": "5.0",
560
- * "uniVer": "√",
561
- * "unixVer": "3.9+"
562
- * },
563
- * "ios": {
564
- * "osVer": "12.0",
565
- * "uniVer": "√",
566
- * "unixVer": "4.11"
567
- * },
568
- * "harmony": {
569
- * "osVer": "3.0",
570
- * "uniVer": "4.23",
571
- * "unixVer": "x"
572
- * }
573
- * },
574
- * "web": {
575
- * "uniVer": "√",
576
- * "unixVer": "4.0"
577
- * }
578
- * }
579
- */
580
- statusCode: number
581
- };
582
- export type UploadFileSuccessCallback = (result: UploadFileSuccess) => void;
583
- /**
584
- * 上传文件失败的错误回调参数
585
- */
586
- export interface UploadFileFail extends IUniError{
587
- errCode: RequestErrorCode
588
- };
589
- export type UploadFileFailCallback = (result: UploadFileFail) => void;
590
-
591
- export type UploadFileCompleteCallback = (result: any) => void;
592
- export type UploadFileOptions = {
593
- /**
594
- * 开发者服务器 url
595
- * @uniPlatform
596
- * {
597
- * "app": {
598
- * "android": {
599
- * "osVer": "5.0",
600
- * "uniVer": "√",
601
- * "unixVer": "3.9+"
602
- * },
603
- * "ios": {
604
- * "osVer": "12.0",
605
- * "uniVer": "",
606
- * "unixVer": "4.11"
607
- * },
608
- * "harmony": {
609
- * "osVer": "3.0",
610
- * "uniVer": "4.23",
611
- * "unixVer": "x"
612
- * }
613
- * },
614
- * "web": {
615
- * "uniVer": "",
616
- * "unixVer": "4.0"
617
- * }
618
- * }
619
- */
620
- url: string,
621
- /**
622
- * 要上传文件资源的路径, 支持uni.env
623
- * @defaultValue null
624
- * @uniPlatform
625
- * {
626
- * "app": {
627
- * "android": {
628
- * "osVer": "5.0",
629
- * "uniVer": "√",
630
- * "unixVer": "3.9+"
631
- * },
632
- * "ios": {
633
- * "osVer": "12.0",
634
- * "uniVer": "√",
635
- * "unixVer": "4.11"
636
- * },
637
- * "harmony": {
638
- * "osVer": "3.0",
639
- * "uniVer": "4.23",
640
- * "unixVer": "x"
641
- * }
642
- * },
643
- * "web": {
644
- * "uniVer": "√",
645
- * "unixVer": "4.0"
646
- * }
647
- * }
648
- */
649
- filePath?: string | null,
650
- /**
651
- * 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容
652
- * @defaultValue null
653
- * @uniPlatform
654
- * {
655
- * "app": {
656
- * "android": {
657
- * "osVer": "5.0",
658
- * "uniVer": "√",
659
- * "unixVer": "3.9+"
660
- * },
661
- * "ios": {
662
- * "osVer": "12.0",
663
- * "uniVer": "√",
664
- * "unixVer": "4.11"
665
- * },
666
- * "harmony": {
667
- * "osVer": "3.0",
668
- * "uniVer": "4.23",
669
- * "unixVer": "x"
670
- * }
671
- * },
672
- * "web": {
673
- * "uniVer": "√",
674
- * "unixVer": "4.0"
675
- * }
676
- * }
677
- */
678
- name?: string | null,
679
- /**
680
- * 需要上传的文件列表。
681
- * @defaultValue null
682
- * @uniPlatform
683
- * {
684
- * "app": {
685
- * "android": {
686
- * "osVer": "5.0",
687
- * "uniVer": "√",
688
- * "unixVer": "3.9+"
689
- * },
690
- * "ios": {
691
- * "osVer": "12.0",
692
- * "uniVer": "√",
693
- * "unixVer": "4.11"
694
- * },
695
- * "harmony": {
696
- * "osVer": "3.0",
697
- * "uniVer": "4.23",
698
- * "unixVer": "x"
699
- * }
700
- * },
701
- * "web": {
702
- * "uniVer": "√",
703
- * "unixVer": "4.0"
704
- * }
705
- * }
706
- */
707
- files?: (UploadFileOptionFiles[]) | null,
708
- /**
709
- * HTTP 请求 Header, header 中不能设置 Referer
710
- * @defaultValue null
711
- * @uniPlatform
712
- * {
713
- * "app": {
714
- * "android": {
715
- * "osVer": "5.0",
716
- * "uniVer": "√",
717
- * "unixVer": "3.9+"
718
- * },
719
- * "ios": {
720
- * "osVer": "12.0",
721
- * "uniVer": "√",
722
- * "unixVer": "4.11"
723
- * },
724
- * "harmony": {
725
- * "osVer": "3.0",
726
- * "uniVer": "4.23",
727
- * "unixVer": "x"
728
- * }
729
- * },
730
- * "web": {
731
- * "uniVer": "√",
732
- * "unixVer": "4.0"
733
- * }
734
- * }
735
- */
736
- header?: UTSJSONObject | null,
737
- /**
738
- * HTTP 请求中其他额外的 form data
739
- * @defaultValue null
740
- * @uniPlatform
741
- * {
742
- * "app": {
743
- * "android": {
744
- * "osVer": "5.0",
745
- * "uniVer": "√",
746
- * "unixVer": "3.9+"
747
- * },
748
- * "ios": {
749
- * "osVer": "12.0",
750
- * "uniVer": "√",
751
- * "unixVer": "4.11"
752
- * },
753
- * "harmony": {
754
- * "osVer": "3.0",
755
- * "uniVer": "4.23",
756
- * "unixVer": "x"
757
- * }
758
- * },
759
- * "web": {
760
- * "uniVer": "√",
761
- * "unixVer": "4.0"
762
- * }
763
- * }
764
- */
765
- formData?: UTSJSONObject | null,
766
- /**
767
- * 超时时间,单位 ms
768
- * @defaultValue 120000
769
- * @uniPlatform
770
- * {
771
- * "app": {
772
- * "android": {
773
- * "osVer": "5.0",
774
- * "uniVer": "√",
775
- * "unixVer": "3.9+"
776
- * },
777
- * "ios": {
778
- * "osVer": "12.0",
779
- * "uniVer": "√",
780
- * "unixVer": "4.11"
781
- * },
782
- * "harmony": {
783
- * "osVer": "3.0",
784
- * "uniVer": "4.23",
785
- * "unixVer": "x"
786
- * }
787
- * },
788
- * "web": {
789
- * "uniVer": "√",
790
- * "unixVer": "4.0"
791
- * }
792
- * }
793
- */
794
- timeout?: number | null,
795
- /**
796
- * 成功返回的回调函数
797
- * @defaultValue null
798
- */
799
- success?: UploadFileSuccessCallback | null,
800
- /**
801
- * 失败的回调函数
802
- * @defaultValue null
803
- */
804
- fail?: UploadFileFailCallback | null,
805
- /**
806
- * 结束的回调函数(调用成功、失败都会执行)
807
- * @defaultValue null
808
- */
809
- complete?: UploadFileCompleteCallback | null
810
- };
811
- export type OnProgressUpdateResult = {
812
- /**
813
- * 上传进度百分比
814
- * @uniPlatform
815
- * {
816
- * "app": {
817
- * "android": {
818
- * "osVer": "5.0",
819
- * "uniVer": "",
820
- * "unixVer": "3.9+"
821
- * },
822
- * "ios": {
823
- * "osVer": "12.0",
824
- * "uniVer": "",
825
- * "unixVer": "4.11"
826
- * },
827
- * "harmony": {
828
- * "osVer": "3.0",
829
- * "uniVer": "4.23",
830
- * "unixVer": "x"
831
- * }
832
- * },
833
- * "web": {
834
- * "uniVer": "√",
835
- * "unixVer": "4.0"
836
- * }
837
- * }
838
- */
839
- progress: number,
840
- /**
841
- * 已经上传的数据长度,单位 Bytes
842
- * @uniPlatform
843
- * {
844
- * "app": {
845
- * "android": {
846
- * "osVer": "5.0",
847
- * "uniVer": "√",
848
- * "unixVer": "3.9+"
849
- * },
850
- * "ios": {
851
- * "osVer": "12.0",
852
- * "uniVer": "√",
853
- * "unixVer": "4.11"
854
- * },
855
- * "harmony": {
856
- * "osVer": "3.0",
857
- * "uniVer": "4.23",
858
- * "unixVer": "x"
859
- * }
860
- * },
861
- * "web": {
862
- * "uniVer": "√",
863
- * "unixVer": "4.0"
864
- * }
865
- * }
866
- */
867
- totalBytesSent: number,
868
- /**
869
- * 预期需要上传的数据总长度,单位 Bytes
870
- * @uniPlatform
871
- * {
872
- * "app": {
873
- * "android": {
874
- * "osVer": "5.0",
875
- * "uniVer": "",
876
- * "unixVer": "3.9+"
877
- * },
878
- * "ios": {
879
- * "osVer": "12.0",
880
- * "uniVer": "√",
881
- * "unixVer": "4.11"
882
- * },
883
- * "harmony": {
884
- * "osVer": "3.0",
885
- * "uniVer": "4.23",
886
- * "unixVer": "x"
887
- * }
888
- * },
889
- * "web": {
890
- * "uniVer": "√",
891
- * "unixVer": "4.0"
892
- * }
893
- * }
894
- */
895
- totalBytesExpectedToSend: number
896
- };
897
-
898
- export type UploadFileProgressUpdateCallback = (result: OnProgressUpdateResult) => void
899
- export interface UploadTask {
900
- /**
901
- * 中断上传任务。
902
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
903
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
904
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
905
- * @uniPlatform
906
- * {
907
- * "app": {
908
- * "android": {
909
- * "osVer": "4.4",
910
- * "uniVer": "√",
911
- * "unixVer": "3.9+"
912
- * },
913
- * "ios": {
914
- * "osVer": "12.0",
915
- * "uniVer": "√",
916
- * "unixVer": "4.11"
917
- * },
918
- * "harmony": {
919
- * "osVer": "3.0",
920
- * "uniVer": "4.23",
921
- * "unixVer": "x"
922
- * }
923
- * },
924
- * "web": {
925
- * "uniVer": "",
926
- * "unixVer": "4.0"
927
- * }
928
- * }
929
- * @example
930
- ```typescript
931
- var uploadTask = uni.uploadFile({
932
- url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,并非真实接口地址。
933
- complete: ()=> {}
934
- });
935
- uploadTask.abort();
936
- ```
937
- */
938
- abort(): void,
939
- /**
940
- * 监听上传进度变化。
941
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
942
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
943
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
944
- * @uniPlatform
945
- * {
946
- * "app": {
947
- * "android": {
948
- * "osVer": "4.4",
949
- * "uniVer": "√",
950
- * "unixVer": "3.9+"
951
- * },
952
- * "ios": {
953
- * "osVer": "12.0",
954
- * "uniVer": "√",
955
- * "unixVer": "4.11"
956
- * },
957
- * "harmony": {
958
- * "osVer": "3.0",
959
- * "uniVer": "4.23",
960
- * "unixVer": "x"
961
- * }
962
- * },
963
- * "web": {
964
- * "uniVer": "√",
965
- * "unixVer": "4.0"
966
- * }
967
- * }
968
- * @example
969
- ```typescript
970
- uploadTask.onProgressUpdate((res) => {
971
- console.log('上传进度' + res.progress);
972
- console.log('已经上传的数据长度' + res.totalBytesSent);
973
- console.log('预期需要上传的数据总长度' + res.totalBytesExpectedToSend);
974
- });
975
- ```
976
- */
977
- onProgressUpdate(callback: UploadFileProgressUpdateCallback): void,
978
- };
979
-
980
- //===============================下载==================================
981
-
982
- export type DownloadFile = (options: DownloadFileOptions) => DownloadTask;
983
- export type DownloadFileSuccess = {
984
- /**
985
- * 临时文件路径,下载后的文件会存储到一个临时文件
986
- * @uniPlatform
987
- * {
988
- * "app": {
989
- * "android": {
990
- * "osVer": "5.0",
991
- * "uniVer": "√",
992
- * "unixVer": "3.9+"
993
- * },
994
- * "ios": {
995
- * "osVer": "12.0",
996
- * "uniVer": "",
997
- * "unixVer": "4.11"
998
- * },
999
- * "harmony": {
1000
- * "osVer": "3.0",
1001
- * "uniVer": "4.23",
1002
- * "unixVer": "x"
1003
- * }
1004
- * },
1005
- * "web": {
1006
- * "uniVer": "",
1007
- * "unixVer": "4.0"
1008
- * }
1009
- * }
1010
- */
1011
- tempFilePath: string,
1012
- /**
1013
- * 开发者服务器返回的 HTTP 状态码
1014
- * @uniPlatform
1015
- * {
1016
- * "app": {
1017
- * "android": {
1018
- * "osVer": "5.0",
1019
- * "uniVer": "√",
1020
- * "unixVer": "3.9+"
1021
- * },
1022
- * "ios": {
1023
- * "osVer": "12.0",
1024
- * "uniVer": "√",
1025
- * "unixVer": "4.11"
1026
- * },
1027
- * "harmony": {
1028
- * "osVer": "3.0",
1029
- * "uniVer": "4.23",
1030
- * "unixVer": "x"
1031
- * }
1032
- * },
1033
- * "web": {
1034
- * "uniVer": "√",
1035
- * "unixVer": "4.0"
1036
- * }
1037
- * }
1038
- */
1039
- statusCode: number
1040
- };
1041
- export type DownloadFileSuccessCallback = (result: DownloadFileSuccess) => void;
1042
- /**
1043
- * 下载文件失败的错误回调参数
1044
- */
1045
- export interface DownloadFileFail extends IUniError{
1046
- errCode: RequestErrorCode
1047
- };
1048
- export type DownloadFileFailCallback = (result: DownloadFileFail) => void;
1049
- export type DownloadFileComplete = any;
1050
- export type DownloadFileCompleteCallback = (result: DownloadFileComplete) => void;
1051
- export type DownloadFileOptions = {
1052
- /**
1053
- * 下载资源的 url
1054
- * @uniPlatform
1055
- * {
1056
- * "app": {
1057
- * "android": {
1058
- * "osVer": "5.0",
1059
- * "uniVer": "√",
1060
- * "unixVer": "3.9+"
1061
- * },
1062
- * "ios": {
1063
- * "osVer": "12.0",
1064
- * "uniVer": "",
1065
- * "unixVer": "4.11"
1066
- * },
1067
- * "harmony": {
1068
- * "osVer": "3.0",
1069
- * "uniVer": "4.23",
1070
- * "unixVer": "x"
1071
- * }
1072
- * },
1073
- * "web": {
1074
- * "uniVer": "",
1075
- * "unixVer": "4.0"
1076
- * }
1077
- * }
1078
- */
1079
- url: string,
1080
- /**
1081
- * HTTP 请求 Header,header 中不能设置 Referer
1082
- * @defaultValue null
1083
- * @uniPlatform
1084
- * {
1085
- * "app": {
1086
- * "android": {
1087
- * "osVer": "5.0",
1088
- * "uniVer": "√",
1089
- * "unixVer": "3.9+"
1090
- * },
1091
- * "ios": {
1092
- * "osVer": "12.0",
1093
- * "uniVer": "√",
1094
- * "unixVer": "4.11"
1095
- * }
1096
- * }
1097
- * }
1098
- */
1099
- header?: UTSJSONObject | null,
1100
- /**
1101
- * 指定文件下载路径
1102
- * 支持相对路径与绝对路径,例:
1103
- * `/imgs/pic.png`、`/storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/temp/imgs/pic.png`
1104
- * 并且支持指定下载目录,例:
1105
- * `/imgs/`
1106
- * 支持uni.env的平台兼容性:Android自3.9开始支持uni.env,iOS自4.13开始支持uni.env
1107
- * @defaultValue null
1108
- * @uniPlatform
1109
- * {
1110
- * "app": {
1111
- * "android": {
1112
- * "osVer": "5.0",
1113
- * "uniVer": "√",
1114
- * "unixVer": "3.9+"
1115
- * },
1116
- * "ios": {
1117
- * "osVer": "12.0",
1118
- * "uniVer": "√",
1119
- * "unixVer": "4.11"
1120
- * },
1121
- * "harmony": {
1122
- * "osVer": "3.0",
1123
- * "uniVer": "4.23",
1124
- * "unixVer": "x"
1125
- * }
1126
- * },
1127
- * "web": {
1128
- * "uniVer": "√",
1129
- * "unixVer": "4.0"
1130
- * }
1131
- * }
1132
- */
1133
- filePath?: string | null,
1134
- /**
1135
- * 超时时间,单位 ms
1136
- * @defaultValue 120000
1137
- * @uniPlatform
1138
- * {
1139
- * "app": {
1140
- * "android": {
1141
- * "osVer": "5.0",
1142
- * "uniVer": "√",
1143
- * "unixVer": "3.9+"
1144
- * },
1145
- * "ios": {
1146
- * "osVer": "12.0",
1147
- * "uniVer": "√",
1148
- * "unixVer": "4.11"
1149
- * },
1150
- * "harmony": {
1151
- * "osVer": "3.0",
1152
- * "uniVer": "4.23",
1153
- * "unixVer": "x"
1154
- * }
1155
- * },
1156
- * "web": {
1157
- * "uniVer": "√",
1158
- * "unixVer": "4.0"
1159
- * }
1160
- * }
1161
- */
1162
- timeout?: number | null,
1163
- /**
1164
- * 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'}
1165
- * @defaultValue null
1166
- */
1167
- success?: DownloadFileSuccessCallback | null,
1168
- /**
1169
- * 失败的回调函数
1170
- * @defaultValue null
1171
- */
1172
- fail?: DownloadFileFailCallback | null,
1173
- /**
1174
- * 结束的回调函数(调用成功、失败都会执行)
1175
- * @defaultValue null
1176
- */
1177
- complete?: DownloadFileCompleteCallback | null
1178
- };
1179
- export type OnProgressDownloadResult = {
1180
- /**
1181
- * 下载进度百分比
1182
- * @uniPlatform
1183
- * {
1184
- * "app": {
1185
- * "android": {
1186
- * "osVer": "5.0",
1187
- * "uniVer": "",
1188
- * "unixVer": "3.9+"
1189
- * },
1190
- * "ios": {
1191
- * "osVer": "12.0",
1192
- * "uniVer": "",
1193
- * "unixVer": "4.11"
1194
- * },
1195
- * "harmony": {
1196
- * "osVer": "3.0",
1197
- * "uniVer": "4.23",
1198
- * "unixVer": "x"
1199
- * }
1200
- * },
1201
- * "web": {
1202
- * "uniVer": "√",
1203
- * "unixVer": "4.0"
1204
- * }
1205
- * }
1206
- */
1207
- progress: number,
1208
- /**
1209
- * 已经下载的数据长度,单位 Bytes
1210
- * @uniPlatform
1211
- * {
1212
- * "app": {
1213
- * "android": {
1214
- * "osVer": "5.0",
1215
- * "uniVer": "√",
1216
- * "unixVer": "3.9+"
1217
- * },
1218
- * "ios": {
1219
- * "osVer": "12.0",
1220
- * "uniVer": "√",
1221
- * "unixVer": "4.11"
1222
- * },
1223
- * "harmony": {
1224
- * "osVer": "3.0",
1225
- * "uniVer": "4.23",
1226
- * "unixVer": "x"
1227
- * }
1228
- * },
1229
- * "web": {
1230
- * "uniVer": "√",
1231
- * "unixVer": "4.0"
1232
- * }
1233
- * }
1234
- */
1235
- totalBytesWritten: number,
1236
- /**
1237
- * 预期需要下载的数据总长度,单位 Bytes
1238
- * @uniPlatform
1239
- * {
1240
- * "app": {
1241
- * "android": {
1242
- * "osVer": "5.0",
1243
- * "uniVer": "",
1244
- * "unixVer": "3.9+"
1245
- * },
1246
- * "ios": {
1247
- * "osVer": "12.0",
1248
- * "uniVer": "√",
1249
- * "unixVer": "4.11"
1250
- * },
1251
- * "harmony": {
1252
- * "osVer": "3.0",
1253
- * "uniVer": "4.23",
1254
- * "unixVer": "x"
1255
- * }
1256
- * },
1257
- * "web": {
1258
- * "uniVer": "√",
1259
- * "unixVer": "4.0"
1260
- * }
1261
- * }
1262
- */
1263
- totalBytesExpectedToWrite: number
1264
- };
1265
- export type DownloadFileProgressUpdateCallback = (result: OnProgressDownloadResult) => void;
1266
- export interface DownloadTask {
1267
- /**
1268
- * 中断下载任务
1269
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
1270
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
1271
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
1272
- * @uniPlatform
1273
- * {
1274
- * "app": {
1275
- * "android": {
1276
- * "osVer": "4.4",
1277
- * "uniVer": "",
1278
- * "unixVer": "3.9+"
1279
- * },
1280
- * "ios": {
1281
- * "osVer": "12.0",
1282
- * "uniVer": "√",
1283
- * "unixVer": "4.11"
1284
- * },
1285
- * "harmony": {
1286
- * "osVer": "3.0",
1287
- * "uniVer": "4.23",
1288
- * "unixVer": "x"
1289
- * }
1290
- * },
1291
- * "web": {
1292
- * "uniVer": "√",
1293
- * "unixVer": "4.0"
1294
- * }
1295
- * }
1296
- * @example
1297
- ```typescript
1298
- var downloadTask = uni.downloadFile({
1299
- url: 'https://www.example.com/file/test', //仅为示例,并非真实接口地址。
1300
- complete: ()=> {}
1301
- });
1302
- downloadTask.abort();
1303
- ```
1304
- */
1305
- abort(): void,
1306
- /**
1307
- * 监听下载进度变化。
1308
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
1309
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
1310
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
1311
- * @uniPlatform
1312
- * {
1313
- * "app": {
1314
- * "android": {
1315
- * "osVer": "4.4",
1316
- * "uniVer": "√",
1317
- * "unixVer": "3.9+"
1318
- * },
1319
- * "ios": {
1320
- * "osVer": "12.0",
1321
- * "uniVer": "√",
1322
- * "unixVer": "4.11"
1323
- * },
1324
- * "harmony": {
1325
- * "osVer": "3.0",
1326
- * "uniVer": "4.23",
1327
- * "unixVer": "x"
1328
- * }
1329
- * },
1330
- * "web": {
1331
- * "uniVer": "√",
1332
- * "unixVer": "4.0"
1333
- * }
1334
- * }
1335
- * @example
1336
- ```typescript
1337
- downloadTask.onProgressUpdate((res) => {
1338
- console.log('下载进度' + res.progress);
1339
- console.log('已经下载的数据长度' + res.totalBytesWritten);
1340
- console.log('预期需要下载的数据总长度' + res.totalBytesExpectedToWrite);
1341
- });
1342
- ```
1343
- */
1344
- onProgressUpdate(callback: DownloadFileProgressUpdateCallback): void,
1345
- };
1346
-
1347
-
1348
- export interface Uni {
1349
- /**
1350
- * 发起网络请求。
1351
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/request.html
1352
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/request.html
1353
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/request.html
1354
- * @uniPlatform
1355
- * {
1356
- * "app": {
1357
- * "android": {
1358
- * "osVer": "4.4",
1359
- * "uniVer": "√",
1360
- * "unixVer": "3.9+"
1361
- * },
1362
- * "ios": {
1363
- * "osVer": "12.0",
1364
- * "uniVer": "√",
1365
- * "unixVer": "4.11"
1366
- * },
1367
- * "harmony": {
1368
- * "osVer": "3.0",
1369
- * "uniVer": "4.23",
1370
- * "unixVer": "x"
1371
- * }
1372
- * },
1373
- * "web": {
1374
- * "uniVer": "√",
1375
- * "unixVer": "4.0"
1376
- * }
1377
- * }
1378
- * @example
1379
- ```typescript
1380
- uni.request({
1381
- url: "http://192.168.12.106:8080/postHalo",
1382
- dataType: "json",
1383
- responseType: "json",
1384
- method: "POST",
1385
- data: {
1386
- platform: "ios",
1387
- },
1388
- // header: {
1389
- // "Content-Type": "application/json",
1390
- // },
1391
- timeout: 6000,
1392
- sslVerify: false,
1393
- withCredentials: false,
1394
- firstIpv4: false,
1395
- success(res) {
1396
- console.log("success :", res.data);
1397
- },
1398
- fail(e) {
1399
- console.log(e);
1400
- },
1401
- complete(res) {
1402
- console.log("complete :", res);
1403
- },
1404
- });
1405
- ```
1406
- */
1407
- request<T>(param: RequestOptions<T>): RequestTask;
1408
- /**
1409
- * 将本地资源上传到开发者服务器。
1410
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
1411
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
1412
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
1413
- * @uniPlatform
1414
- * {
1415
- * "app": {
1416
- * "android": {
1417
- * "osVer": "4.4",
1418
- * "uniVer": "√",
1419
- * "unixVer": "3.9+"
1420
- * },
1421
- * "ios": {
1422
- * "osVer": "12.0",
1423
- * "uniVer": "√",
1424
- * "unixVer": "4.11"
1425
- * },
1426
- * "harmony": {
1427
- * "osVer": "3.0",
1428
- * "uniVer": "4.23",
1429
- * "unixVer": "x"
1430
- * }
1431
- * },
1432
- * "web": {
1433
- * "uniVer": "√",
1434
- * "unixVer": "4.0"
1435
- * }
1436
- * }
1437
- * @example
1438
- ```typescript
1439
- uni.uploadFile({
1440
- url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,非真实的接口地址
1441
- filePath: "/static/logo.png",
1442
- name: 'file',
1443
- formData: {
1444
- 'user': 'test'
1445
- },
1446
- success: (uploadFileRes) => {
1447
- console.log(uploadFileRes.data);
1448
- }
1449
- });
1450
- ```
1451
- */
1452
- uploadFile(options: UploadFileOptions): UploadTask;
1453
- /**
1454
- * 下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。
1455
- * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
1456
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
1457
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
1458
- * @uniPlatform
1459
- * {
1460
- * "app": {
1461
- * "android": {
1462
- * "osVer": "4.4",
1463
- * "uniVer": "",
1464
- * "unixVer": "3.9+"
1465
- * },
1466
- * "ios": {
1467
- * "osVer": "12.0",
1468
- * "uniVer": "",
1469
- * "unixVer": "4.11"
1470
- * },
1471
- * "harmony": {
1472
- * "osVer": "3.0",
1473
- * "uniVer": "4.23",
1474
- * "unixVer": "x"
1475
- * }
1476
- * },
1477
- * "web": {
1478
- * "uniVer": "√",
1479
- * "unixVer": "4.0"
1480
- * }
1481
- * }
1482
- * @example
1483
- ```typescript
1484
- uni.downloadFile({
1485
- url: "http://192.168.12.106:8080/downloadfile",
1486
- success(e) {
1487
- console.log("success111 :", e);
1488
- }
1489
- });
1490
- ```
1491
- */
1492
- downloadFile(options: DownloadFileOptions): DownloadTask;
1493
- }
1
+ export type Request<T> = (param: RequestOptions<T>) => RequestTask;
2
+
3
+ /**
4
+ * 网络请求参数
5
+ */
6
+ export type RequestOptions<T> = {
7
+ /**
8
+ * 开发者服务器接口地址
9
+ *
10
+ * @uniPlatform
11
+ * {
12
+ * "app": {
13
+ * "android": {
14
+ * "osVer": "5.0",
15
+ * "uniVer": "√",
16
+ * "unixVer": "3.9+"
17
+ * },
18
+ * "ios": {
19
+ * "osVer": "12.0",
20
+ * "uniVer": "√",
21
+ * "unixVer": "4.11"
22
+ * },
23
+ * "harmony": {
24
+ * "osVer": "3.0",
25
+ * "uniVer": "4.23",
26
+ * "unixVer": "x"
27
+ * }
28
+ * },
29
+ * "web": {
30
+ * "uniVer": "√",
31
+ * "unixVer": "4.0"
32
+ * }
33
+ * }
34
+ */
35
+ url: string,
36
+ /**
37
+ * 请求的参数 在`app-android端,参数类型只能为`UTSJSONObject`或者`string`类型
38
+ * @type {RequestDataOptions}
39
+ * @defaultValue null
40
+ * @uniPlatform
41
+ * {
42
+ * "app": {
43
+ * "android": {
44
+ * "osVer": "5.0",
45
+ * "uniVer": "√",
46
+ * "unixVer": "3.9+"
47
+ * },
48
+ * "ios": {
49
+ * "osVer": "12.0",
50
+ * "uniVer": "√",
51
+ * "unixVer": "4.11"
52
+ * },
53
+ * "harmony": {
54
+ * "osVer": "3.0",
55
+ * "uniVer": "4.23",
56
+ * "unixVer": "x"
57
+ * }
58
+ * },
59
+ * "web": {
60
+ * "uniVer": "√",
61
+ * "unixVer": "4.0"
62
+ * }
63
+ * }
64
+ */
65
+ data?: any | null,
66
+ /**
67
+ * 设置请求的 header,header 中不能设置 Referer
68
+ * @defaultValue null
69
+ * @uniPlatform
70
+ * {
71
+ * "app": {
72
+ * "android": {
73
+ * "osVer": "5.0",
74
+ * "uniVer": "√",
75
+ * "unixVer": "3.9+"
76
+ * },
77
+ * "ios": {
78
+ * "osVer": "12.0",
79
+ * "uniVer": "√",
80
+ * "unixVer": "4.11"
81
+ * },
82
+ * "harmony": {
83
+ * "osVer": "3.0",
84
+ * "uniVer": "4.23",
85
+ * "unixVer": "x"
86
+ * }
87
+ * },
88
+ * "web": {
89
+ * "uniVer": "√",
90
+ * "unixVer": "4.0"
91
+ * }
92
+ * }
93
+ */
94
+ header?: UTSJSONObject | null,
95
+ /**
96
+ * 请求方法,如果设置的值不在取值范围内,会以GET方法进行请求。
97
+ * @defaultValue "GET"
98
+ * @uniPlatform
99
+ * {
100
+ * "app": {
101
+ * "android": {
102
+ * "osVer": "5.0",
103
+ * "uniVer": "√",
104
+ * "unixVer": "3.9+"
105
+ * },
106
+ * "ios": {
107
+ * "osVer": "12.0",
108
+ * "uniVer": "√",
109
+ * "unixVer": "4.11"
110
+ * },
111
+ * "harmony": {
112
+ * "osVer": "3.0",
113
+ * "uniVer": "4.23",
114
+ * "unixVer": "x"
115
+ * }
116
+ * },
117
+ * "web": {
118
+ * "uniVer": "√",
119
+ * "unixVer": "4.0"
120
+ * }
121
+ * }
122
+ */
123
+ method?: RequestMethod | null,
124
+ /**
125
+ * 超时时间,单位 ms
126
+ * @defaultValue 60000
127
+ * @uniPlatform
128
+ * {
129
+ * "app": {
130
+ * "android": {
131
+ * "osVer": "5.0",
132
+ * "uniVer": "√",
133
+ * "unixVer": "3.9+"
134
+ * },
135
+ * "ios": {
136
+ * "osVer": "12.0",
137
+ * "uniVer": "√",
138
+ * "unixVer": "4.11"
139
+ * }
140
+ * }
141
+ * }
142
+ */
143
+ timeout?: number | null,
144
+ /**
145
+ * 如果设为 json,会对返回的数据进行一次 JSON.parse,非 json 不会进行 JSON.parse
146
+ * @defaultValue "json"
147
+ * @deprecated 不支持
148
+ * @autodoc false
149
+ */
150
+ dataType?: string | null,
151
+ /**
152
+ * 设置响应的数据类型。
153
+ *
154
+ * @deprecated 不支持
155
+ * @autodoc false
156
+ */
157
+ responseType?: string | null,
158
+ /**
159
+ * 验证 ssl 证书
160
+ *
161
+ * @deprecated 不支持
162
+ * @autodoc false
163
+ */
164
+ sslVerify?: boolean | null,
165
+ /**
166
+ * 跨域请求时是否携带凭证(cookies)
167
+ *
168
+ * @uniPlatform
169
+ * {
170
+ * "app": {
171
+ * "android": {
172
+ * "osVer": "4.4",
173
+ * "uniVer": "√",
174
+ * "unixVer": "x"
175
+ * },
176
+ * "ios": {
177
+ * "osVer": "12.0",
178
+ * "uniVer": "√",
179
+ * "unixVer": "x"
180
+ * },
181
+ * "harmony": {
182
+ * "osVer": "x",
183
+ * "uniVer": "x",
184
+ * "unixVer": "x"
185
+ * }
186
+ * },
187
+ * "web": {
188
+ * "uniVer": "√",
189
+ * "unixVer": "4.0"
190
+ * }
191
+ * }
192
+ */
193
+ withCredentials?: boolean | null,
194
+ /**
195
+ * DNS解析时优先使用ipv4
196
+ * @defaultValue false
197
+ * @uniPlatform
198
+ * {
199
+ * "app": {
200
+ * "android": {
201
+ * "osVer": "5.0",
202
+ * "uniVer": "√",
203
+ * "unixVer": "x"
204
+ * },
205
+ * "ios": {
206
+ * "osVer": "12.0",
207
+ * "uniVer": "√",
208
+ * "unixVer": "x"
209
+ * },
210
+ * "harmony": {
211
+ * "osVer": "x",
212
+ * "uniVer": "x",
213
+ * "unixVer": "x"
214
+ * }
215
+ * },
216
+ * "web": {
217
+ * "uniVer": "x",
218
+ * "unixVer": "x"
219
+ * }
220
+ * }
221
+ */
222
+ firstIpv4?: boolean | null,
223
+ /**
224
+ * 网络请求成功回调。
225
+ * @defaultValue null
226
+ */
227
+ success?: RequestSuccessCallback<T> | null,
228
+ /**
229
+ * 网络请求失败回调。
230
+ * @defaultValue null
231
+ */
232
+ fail?: RequestFailCallback | null,
233
+ /**
234
+ * 网络请求完成回调,成功或者失败都会调用。
235
+ * @defaultValue null
236
+ */
237
+ complete?: RequestCompleteCallback | null
238
+ }
239
+
240
+ export type RequestSuccess<T> = {
241
+ /**
242
+ * 开发者服务器返回的数据
243
+ * @type {RequestDataOptions}
244
+ * @uniPlatform
245
+ * {
246
+ * "app": {
247
+ * "android": {
248
+ * "osVer": "5.0",
249
+ * "uniVer": "√",
250
+ * "unixVer": "3.9+"
251
+ * },
252
+ * "ios": {
253
+ * "osVer": "12.0",
254
+ * "uniVer": "√",
255
+ * "unixVer": "4.11"
256
+ * },
257
+ * "harmony": {
258
+ * "osVer": "3.0",
259
+ * "uniVer": "4.23",
260
+ * "unixVer": "x"
261
+ * }
262
+ * },
263
+ * "web": {
264
+ * "uniVer": "√",
265
+ * "unixVer": "4.0"
266
+ * }
267
+ * }
268
+ */
269
+ data: T | null,
270
+ /**
271
+ * 开发者服务器返回的 HTTP 状态码
272
+ * @uniPlatform
273
+ * {
274
+ * "app": {
275
+ * "android": {
276
+ * "osVer": "5.0",
277
+ * "uniVer": "√",
278
+ * "unixVer": "3.9+"
279
+ * },
280
+ * "ios": {
281
+ * "osVer": "12.0",
282
+ * "uniVer": "√",
283
+ * "unixVer": "4.11"
284
+ * },
285
+ * "harmony": {
286
+ * "osVer": "3.0",
287
+ * "uniVer": "4.23",
288
+ * "unixVer": "x"
289
+ * }
290
+ * },
291
+ * "web": {
292
+ * "uniVer": "√",
293
+ * "unixVer": "4.0"
294
+ * }
295
+ * }
296
+ */
297
+ statusCode: number,
298
+ /**
299
+ * 开发者服务器返回的 HTTP Response Header
300
+ * @uniPlatform
301
+ * {
302
+ * "app": {
303
+ * "android": {
304
+ * "osVer": "5.0",
305
+ * "uniVer": "√",
306
+ * "unixVer": "3.9+"
307
+ * },
308
+ * "ios": {
309
+ * "osVer": "12.0",
310
+ * "uniVer": "√",
311
+ * "unixVer": "4.11"
312
+ * },
313
+ * "harmony": {
314
+ * "osVer": "3.0",
315
+ * "uniVer": "4.23",
316
+ * "unixVer": "x"
317
+ * }
318
+ * },
319
+ * "web": {
320
+ * "uniVer": "√",
321
+ * "unixVer": "4.0"
322
+ * }
323
+ * }
324
+ */
325
+ header: any,
326
+ /**
327
+ * 开发者服务器返回的 cookies,格式为字符串数组
328
+ * @uniPlatform
329
+ * {
330
+ * "app": {
331
+ * "android": {
332
+ * "osVer": "5.0",
333
+ * "uniVer": "√",
334
+ * "unixVer": "3.9+"
335
+ * },
336
+ * "ios": {
337
+ * "osVer": "12.0",
338
+ * "uniVer": "√",
339
+ * "unixVer": "4.11"
340
+ * },
341
+ * "harmony": {
342
+ * "osVer": "3.0",
343
+ * "uniVer": "4.23",
344
+ * "unixVer": "x"
345
+ * }
346
+ * },
347
+ * "web": {
348
+ * "uniVer": "x",
349
+ * "unixVer": "x"
350
+ * }
351
+ * }
352
+ */
353
+ cookies: Array<string>
354
+ }
355
+
356
+ /**
357
+ * 请求方法
358
+ */
359
+ export type RequestMethod =
360
+ /**
361
+ * GET方法请求一个指定资源的表示形式,使用 GET 的请求应该只被用于获取数据。
362
+ */
363
+ "GET" |
364
+ /**
365
+ * POST方法用于将实体提交到指定的资源,通常导致在服务器上的状态变化或副作用。
366
+ */
367
+ "POST" |
368
+ /**
369
+ * PUT方法用有效载荷请求替换目标资源的所有当前表示。
370
+ */
371
+ "PUT" |
372
+ /**
373
+ * PATCH方法用于对资源应用部分修改。
374
+ */
375
+ "PATCH" |
376
+ /**
377
+ * DELETE方法删除指定的资源。
378
+ */
379
+ "DELETE" |
380
+ /**
381
+ * HEAD方法请求一个与GET请求的响应相同的响应,但没有响应体。
382
+ */
383
+ "HEAD" |
384
+ /**
385
+ * OPTIONS 方法用于描述目标资源的通信选项。
386
+ */
387
+ "OPTIONS";
388
+
389
+ /**
390
+ * 错误码
391
+ */
392
+ export type RequestErrorCode =
393
+ /**
394
+ * 接口超时
395
+ */
396
+ 5 |
397
+ /**
398
+ * 服务端系统错误
399
+ */
400
+ 1000 |
401
+ /**
402
+ * json数据解析错误
403
+ */
404
+ 100001 |
405
+ /**
406
+ * 错误信息json解析失败
407
+ */
408
+ 100002 |
409
+ /**
410
+ * 网络中断
411
+ */
412
+ 600003 |
413
+ /**
414
+ * data参数类型不合法
415
+ */
416
+ 600008 |
417
+ /**
418
+ * URL格式不合法
419
+ */
420
+ 600009 |
421
+ /**
422
+ * request系统错误
423
+ */
424
+ 602001;
425
+
426
+ /**
427
+ * 网络请求失败的错误回调参数
428
+ */
429
+ export interface RequestFail extends IUniError{
430
+ errCode: RequestErrorCode
431
+ };
432
+ export type RequestSuccessCallback<T> = (option: RequestSuccess<T>) => void;
433
+ export type RequestFailCallback = (option: RequestFail) => void;
434
+ export type RequestCompleteCallback = (option: any) => void;
435
+
436
+
437
+ export interface RequestTask {
438
+ /**
439
+ * 中断网络请求。
440
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/request.html
441
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/request.html
442
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/request.html
443
+ * @uniPlatform
444
+ * {
445
+ * "app": {
446
+ * "android": {
447
+ * "osVer": "4.4",
448
+ * "uniVer": "√",
449
+ * "unixVer": "3.9+"
450
+ * },
451
+ * "ios": {
452
+ * "osVer": "12.0",
453
+ * "uniVer": "√",
454
+ * "unixVer": "4.11"
455
+ * },
456
+ * "harmony": {
457
+ * "osVer": "3.0",
458
+ * "uniVer": "4.23",
459
+ * "unixVer": "x"
460
+ * }
461
+ * },
462
+ * "web": {
463
+ * "uniVer": "√",
464
+ * "unixVer": "4.0"
465
+ * }
466
+ * }
467
+ * @example
468
+ ```typescript
469
+ var requestTask = uni.request({
470
+ url: 'http://192.168.12.106:8080/postHalo', //仅为示例,并非真实接口地址。
471
+ complete: ()=> {}
472
+ });
473
+ requestTask.abort();
474
+ ```
475
+ */
476
+ abort(): void
477
+ }
478
+
479
+ //===============================上传==================================
480
+
481
+
482
+ export type UploadFile = (options: UploadFileOptions) => UploadTask;
483
+ export type UploadFileOptionFiles = {
484
+ /**
485
+ * multipart 提交时,表单的项目名,默认为 file,如果 name 不填或填的值相同,可能导致服务端读取文件时只能读取到一个文件。
486
+ * @defaultValue "file"
487
+ * @uniPlatform
488
+ * {
489
+ * "app": {
490
+ * "android": {
491
+ * "osVer": "5.0",
492
+ * "uniVer": "√",
493
+ * "unixVer": "3.9+"
494
+ * },
495
+ * "ios": {
496
+ * "osVer": "12.0",
497
+ * "uniVer": "√",
498
+ * "unixVer": "4.11"
499
+ * },
500
+ * "harmony": {
501
+ * "osVer": "3.0",
502
+ * "uniVer": "4.23",
503
+ * "unixVer": "x"
504
+ * }
505
+ * },
506
+ * "web": {
507
+ * "uniVer": "√",
508
+ * "unixVer": "4.0"
509
+ * }
510
+ * }
511
+ */
512
+ name?: string | null,
513
+ /**
514
+ * 要上传文件资源的路径
515
+ * @uniPlatform
516
+ * {
517
+ * "app": {
518
+ * "android": {
519
+ * "osVer": "5.0",
520
+ * "uniVer": "√",
521
+ * "unixVer": "3.9+"
522
+ * },
523
+ * "ios": {
524
+ * "osVer": "12.0",
525
+ * "uniVer": "√",
526
+ * "unixVer": "4.11"
527
+ * },
528
+ * "harmony": {
529
+ * "osVer": "3.0",
530
+ * "uniVer": "4.23",
531
+ * "unixVer": "x"
532
+ * }
533
+ * },
534
+ * "web": {
535
+ * "uniVer": "x",
536
+ * "unixVer": "x"
537
+ * }
538
+ * }
539
+ */
540
+ uri: string,
541
+ /**
542
+ * 要上传的文件对象
543
+ * @uniPlatform
544
+ * {
545
+ * "app": {
546
+ * "android": {
547
+ * "osVer": "4.4",
548
+ * "uniVer": "",
549
+ * "unixVer": "3.9+"
550
+ * },
551
+ * "ios": {
552
+ * "osVer": "12.0",
553
+ * "uniVer": "√",
554
+ * "unixVer": "4.11"
555
+ * },
556
+ * "harmony": {
557
+ * "osVer": "x",
558
+ * "uniVer": "x",
559
+ * "unixVer": "x"
560
+ * }
561
+ * },
562
+ * "web": {
563
+ * "uniVer": "√",
564
+ * "unixVer": "4.0"
565
+ * }
566
+ * }
567
+ */
568
+ file?: any | null
569
+ };
570
+ export type UploadFileSuccess = {
571
+ /**
572
+ * 开发者服务器返回的数据
573
+ * @uniPlatform
574
+ * {
575
+ * "app": {
576
+ * "android": {
577
+ * "osVer": "5.0",
578
+ * "uniVer": "√",
579
+ * "unixVer": "3.9+"
580
+ * },
581
+ * "ios": {
582
+ * "osVer": "12.0",
583
+ * "uniVer": "√",
584
+ * "unixVer": "4.11"
585
+ * },
586
+ * "harmony": {
587
+ * "osVer": "3.0",
588
+ * "uniVer": "4.23",
589
+ * "unixVer": "x"
590
+ * }
591
+ * },
592
+ * "web": {
593
+ * "uniVer": "√",
594
+ * "unixVer": "4.0"
595
+ * }
596
+ * }
597
+ */
598
+ data: string,
599
+ /**
600
+ * 开发者服务器返回的 HTTP 状态码
601
+ * @uniPlatform
602
+ * {
603
+ * "app": {
604
+ * "android": {
605
+ * "osVer": "5.0",
606
+ * "uniVer": "",
607
+ * "unixVer": "3.9+"
608
+ * },
609
+ * "ios": {
610
+ * "osVer": "12.0",
611
+ * "uniVer": "",
612
+ * "unixVer": "4.11"
613
+ * },
614
+ * "harmony": {
615
+ * "osVer": "3.0",
616
+ * "uniVer": "4.23",
617
+ * "unixVer": "x"
618
+ * }
619
+ * },
620
+ * "web": {
621
+ * "uniVer": "√",
622
+ * "unixVer": "4.0"
623
+ * }
624
+ * }
625
+ */
626
+ statusCode: number
627
+ };
628
+ export type UploadFileSuccessCallback = (result: UploadFileSuccess) => void;
629
+ /**
630
+ * 上传文件失败的错误回调参数
631
+ */
632
+ export interface UploadFileFail extends IUniError{
633
+ errCode: RequestErrorCode
634
+ };
635
+ export type UploadFileFailCallback = (result: UploadFileFail) => void;
636
+
637
+ export type UploadFileCompleteCallback = (result: any) => void;
638
+ export type UploadFileOptions = {
639
+ /**
640
+ * 开发者服务器 url
641
+ * @uniPlatform
642
+ * {
643
+ * "app": {
644
+ * "android": {
645
+ * "osVer": "5.0",
646
+ * "uniVer": "√",
647
+ * "unixVer": "3.9+"
648
+ * },
649
+ * "ios": {
650
+ * "osVer": "12.0",
651
+ * "uniVer": "√",
652
+ * "unixVer": "4.11"
653
+ * },
654
+ * "harmony": {
655
+ * "osVer": "3.0",
656
+ * "uniVer": "4.23",
657
+ * "unixVer": "x"
658
+ * }
659
+ * },
660
+ * "web": {
661
+ * "uniVer": "√",
662
+ * "unixVer": "4.0"
663
+ * }
664
+ * }
665
+ */
666
+ url: string,
667
+ /**
668
+ * 要上传文件资源的路径, 支持uni.env
669
+ * @defaultValue null
670
+ * @uniPlatform
671
+ * {
672
+ * "app": {
673
+ * "android": {
674
+ * "osVer": "5.0",
675
+ * "uniVer": "√",
676
+ * "unixVer": "3.9+"
677
+ * },
678
+ * "ios": {
679
+ * "osVer": "12.0",
680
+ * "uniVer": "√",
681
+ * "unixVer": "4.11"
682
+ * },
683
+ * "harmony": {
684
+ * "osVer": "3.0",
685
+ * "uniVer": "4.23",
686
+ * "unixVer": "x"
687
+ * }
688
+ * },
689
+ * "web": {
690
+ * "uniVer": "√",
691
+ * "unixVer": "4.0"
692
+ * }
693
+ * }
694
+ */
695
+ filePath?: string | null,
696
+ /**
697
+ * 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容
698
+ * @defaultValue null
699
+ * @uniPlatform
700
+ * {
701
+ * "app": {
702
+ * "android": {
703
+ * "osVer": "5.0",
704
+ * "uniVer": "√",
705
+ * "unixVer": "3.9+"
706
+ * },
707
+ * "ios": {
708
+ * "osVer": "12.0",
709
+ * "uniVer": "√",
710
+ * "unixVer": "4.11"
711
+ * },
712
+ * "harmony": {
713
+ * "osVer": "3.0",
714
+ * "uniVer": "4.23",
715
+ * "unixVer": "x"
716
+ * }
717
+ * },
718
+ * "web": {
719
+ * "uniVer": "√",
720
+ * "unixVer": "4.0"
721
+ * }
722
+ * }
723
+ */
724
+ name?: string | null,
725
+ /**
726
+ * 需要上传的文件列表。
727
+ * @defaultValue null
728
+ * @uniPlatform
729
+ * {
730
+ * "app": {
731
+ * "android": {
732
+ * "osVer": "5.0",
733
+ * "uniVer": "√",
734
+ * "unixVer": "3.9+"
735
+ * },
736
+ * "ios": {
737
+ * "osVer": "12.0",
738
+ * "uniVer": "√",
739
+ * "unixVer": "4.11"
740
+ * },
741
+ * "harmony": {
742
+ * "osVer": "3.0",
743
+ * "uniVer": "4.23",
744
+ * "unixVer": "x"
745
+ * }
746
+ * },
747
+ * "web": {
748
+ * "uniVer": "√",
749
+ * "unixVer": "4.0"
750
+ * }
751
+ * }
752
+ */
753
+ files?: (UploadFileOptionFiles[]) | null,
754
+ /**
755
+ * HTTP 请求 Header, header 中不能设置 Referer
756
+ * @defaultValue null
757
+ * @uniPlatform
758
+ * {
759
+ * "app": {
760
+ * "android": {
761
+ * "osVer": "5.0",
762
+ * "uniVer": "√",
763
+ * "unixVer": "3.9+"
764
+ * },
765
+ * "ios": {
766
+ * "osVer": "12.0",
767
+ * "uniVer": "√",
768
+ * "unixVer": "4.11"
769
+ * },
770
+ * "harmony": {
771
+ * "osVer": "3.0",
772
+ * "uniVer": "4.23",
773
+ * "unixVer": "x"
774
+ * }
775
+ * },
776
+ * "web": {
777
+ * "uniVer": "√",
778
+ * "unixVer": "4.0"
779
+ * }
780
+ * }
781
+ */
782
+ header?: UTSJSONObject | null,
783
+ /**
784
+ * HTTP 请求中其他额外的 form data
785
+ * @defaultValue null
786
+ * @uniPlatform
787
+ * {
788
+ * "app": {
789
+ * "android": {
790
+ * "osVer": "5.0",
791
+ * "uniVer": "√",
792
+ * "unixVer": "3.9+"
793
+ * },
794
+ * "ios": {
795
+ * "osVer": "12.0",
796
+ * "uniVer": "√",
797
+ * "unixVer": "4.11"
798
+ * },
799
+ * "harmony": {
800
+ * "osVer": "3.0",
801
+ * "uniVer": "4.23",
802
+ * "unixVer": "x"
803
+ * }
804
+ * },
805
+ * "web": {
806
+ * "uniVer": "√",
807
+ * "unixVer": "4.0"
808
+ * }
809
+ * }
810
+ */
811
+ formData?: UTSJSONObject | null,
812
+ /**
813
+ * 超时时间,单位 ms
814
+ * @defaultValue 120000
815
+ * @uniPlatform
816
+ * {
817
+ * "app": {
818
+ * "android": {
819
+ * "osVer": "5.0",
820
+ * "uniVer": "",
821
+ * "unixVer": "3.9+"
822
+ * },
823
+ * "ios": {
824
+ * "osVer": "12.0",
825
+ * "uniVer": "",
826
+ * "unixVer": "4.11"
827
+ * },
828
+ * "harmony": {
829
+ * "osVer": "3.0",
830
+ * "uniVer": "4.23",
831
+ * "unixVer": "x"
832
+ * }
833
+ * },
834
+ * "web": {
835
+ * "uniVer": "",
836
+ * "unixVer": "4.0"
837
+ * }
838
+ * }
839
+ */
840
+ timeout?: number | null,
841
+ /**
842
+ * 成功返回的回调函数
843
+ * @defaultValue null
844
+ */
845
+ success?: UploadFileSuccessCallback | null,
846
+ /**
847
+ * 失败的回调函数
848
+ * @defaultValue null
849
+ */
850
+ fail?: UploadFileFailCallback | null,
851
+ /**
852
+ * 结束的回调函数(调用成功、失败都会执行)
853
+ * @defaultValue null
854
+ */
855
+ complete?: UploadFileCompleteCallback | null
856
+ };
857
+ export type OnProgressUpdateResult = {
858
+ /**
859
+ * 上传进度百分比
860
+ * @uniPlatform
861
+ * {
862
+ * "app": {
863
+ * "android": {
864
+ * "osVer": "5.0",
865
+ * "uniVer": "√",
866
+ * "unixVer": "3.9+"
867
+ * },
868
+ * "ios": {
869
+ * "osVer": "12.0",
870
+ * "uniVer": "√",
871
+ * "unixVer": "4.11"
872
+ * },
873
+ * "harmony": {
874
+ * "osVer": "3.0",
875
+ * "uniVer": "4.23",
876
+ * "unixVer": "x"
877
+ * }
878
+ * },
879
+ * "web": {
880
+ * "uniVer": "√",
881
+ * "unixVer": "4.0"
882
+ * }
883
+ * }
884
+ */
885
+ progress: number,
886
+ /**
887
+ * 已经上传的数据长度,单位 Bytes
888
+ * @uniPlatform
889
+ * {
890
+ * "app": {
891
+ * "android": {
892
+ * "osVer": "5.0",
893
+ * "uniVer": "√",
894
+ * "unixVer": "3.9+"
895
+ * },
896
+ * "ios": {
897
+ * "osVer": "12.0",
898
+ * "uniVer": "√",
899
+ * "unixVer": "4.11"
900
+ * },
901
+ * "harmony": {
902
+ * "osVer": "3.0",
903
+ * "uniVer": "4.23",
904
+ * "unixVer": "x"
905
+ * }
906
+ * },
907
+ * "web": {
908
+ * "uniVer": "√",
909
+ * "unixVer": "4.0"
910
+ * }
911
+ * }
912
+ */
913
+ totalBytesSent: number,
914
+ /**
915
+ * 预期需要上传的数据总长度,单位 Bytes
916
+ * @uniPlatform
917
+ * {
918
+ * "app": {
919
+ * "android": {
920
+ * "osVer": "5.0",
921
+ * "uniVer": "",
922
+ * "unixVer": "3.9+"
923
+ * },
924
+ * "ios": {
925
+ * "osVer": "12.0",
926
+ * "uniVer": "",
927
+ * "unixVer": "4.11"
928
+ * },
929
+ * "harmony": {
930
+ * "osVer": "3.0",
931
+ * "uniVer": "4.23",
932
+ * "unixVer": "x"
933
+ * }
934
+ * },
935
+ * "web": {
936
+ * "uniVer": "√",
937
+ * "unixVer": "4.0"
938
+ * }
939
+ * }
940
+ */
941
+ totalBytesExpectedToSend: number
942
+ };
943
+
944
+ export type UploadFileProgressUpdateCallback = (result: OnProgressUpdateResult) => void
945
+ export interface UploadTask {
946
+ /**
947
+ * 中断上传任务。
948
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
949
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
950
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
951
+ * @uniPlatform
952
+ * {
953
+ * "app": {
954
+ * "android": {
955
+ * "osVer": "4.4",
956
+ * "uniVer": "√",
957
+ * "unixVer": "3.9+"
958
+ * },
959
+ * "ios": {
960
+ * "osVer": "12.0",
961
+ * "uniVer": "√",
962
+ * "unixVer": "4.11"
963
+ * },
964
+ * "harmony": {
965
+ * "osVer": "3.0",
966
+ * "uniVer": "4.23",
967
+ * "unixVer": "x"
968
+ * }
969
+ * },
970
+ * "web": {
971
+ * "uniVer": "√",
972
+ * "unixVer": "4.0"
973
+ * }
974
+ * }
975
+ * @example
976
+ ```typescript
977
+ var uploadTask = uni.uploadFile({
978
+ url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,并非真实接口地址。
979
+ complete: ()=> {}
980
+ });
981
+ uploadTask.abort();
982
+ ```
983
+ */
984
+ abort(): void,
985
+ /**
986
+ * 监听上传进度变化。
987
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
988
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
989
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
990
+ * @uniPlatform
991
+ * {
992
+ * "app": {
993
+ * "android": {
994
+ * "osVer": "4.4",
995
+ * "uniVer": "",
996
+ * "unixVer": "3.9+"
997
+ * },
998
+ * "ios": {
999
+ * "osVer": "12.0",
1000
+ * "uniVer": "",
1001
+ * "unixVer": "4.11"
1002
+ * },
1003
+ * "harmony": {
1004
+ * "osVer": "3.0",
1005
+ * "uniVer": "4.23",
1006
+ * "unixVer": "x"
1007
+ * }
1008
+ * },
1009
+ * "web": {
1010
+ * "uniVer": "√",
1011
+ * "unixVer": "4.0"
1012
+ * }
1013
+ * }
1014
+ * @example
1015
+ ```typescript
1016
+ uploadTask.onProgressUpdate((res) => {
1017
+ console.log('上传进度' + res.progress);
1018
+ console.log('已经上传的数据长度' + res.totalBytesSent);
1019
+ console.log('预期需要上传的数据总长度' + res.totalBytesExpectedToSend);
1020
+ });
1021
+ ```
1022
+ */
1023
+ onProgressUpdate(callback: UploadFileProgressUpdateCallback): void,
1024
+ };
1025
+
1026
+ //===============================下载==================================
1027
+
1028
+ export type DownloadFile = (options: DownloadFileOptions) => DownloadTask;
1029
+ export type DownloadFileSuccess = {
1030
+ /**
1031
+ * 临时文件路径,下载后的文件会存储到一个临时文件
1032
+ * @uniPlatform
1033
+ * {
1034
+ * "app": {
1035
+ * "android": {
1036
+ * "osVer": "5.0",
1037
+ * "uniVer": "√",
1038
+ * "unixVer": "3.9+"
1039
+ * },
1040
+ * "ios": {
1041
+ * "osVer": "12.0",
1042
+ * "uniVer": "√",
1043
+ * "unixVer": "4.11"
1044
+ * },
1045
+ * "harmony": {
1046
+ * "osVer": "3.0",
1047
+ * "uniVer": "4.23",
1048
+ * "unixVer": "x"
1049
+ * }
1050
+ * },
1051
+ * "web": {
1052
+ * "uniVer": "√",
1053
+ * "unixVer": "4.0"
1054
+ * }
1055
+ * }
1056
+ */
1057
+ tempFilePath: string,
1058
+ /**
1059
+ * 开发者服务器返回的 HTTP 状态码
1060
+ * @uniPlatform
1061
+ * {
1062
+ * "app": {
1063
+ * "android": {
1064
+ * "osVer": "5.0",
1065
+ * "uniVer": "",
1066
+ * "unixVer": "3.9+"
1067
+ * },
1068
+ * "ios": {
1069
+ * "osVer": "12.0",
1070
+ * "uniVer": "",
1071
+ * "unixVer": "4.11"
1072
+ * },
1073
+ * "harmony": {
1074
+ * "osVer": "3.0",
1075
+ * "uniVer": "4.23",
1076
+ * "unixVer": "x"
1077
+ * }
1078
+ * },
1079
+ * "web": {
1080
+ * "uniVer": "√",
1081
+ * "unixVer": "4.0"
1082
+ * }
1083
+ * }
1084
+ */
1085
+ statusCode: number
1086
+ };
1087
+ export type DownloadFileSuccessCallback = (result: DownloadFileSuccess) => void;
1088
+ /**
1089
+ * 下载文件失败的错误回调参数
1090
+ */
1091
+ export interface DownloadFileFail extends IUniError{
1092
+ errCode: RequestErrorCode
1093
+ };
1094
+ export type DownloadFileFailCallback = (result: DownloadFileFail) => void;
1095
+ export type DownloadFileComplete = any;
1096
+ export type DownloadFileCompleteCallback = (result: DownloadFileComplete) => void;
1097
+ export type DownloadFileOptions = {
1098
+ /**
1099
+ * 下载资源的 url
1100
+ * @uniPlatform
1101
+ * {
1102
+ * "app": {
1103
+ * "android": {
1104
+ * "osVer": "5.0",
1105
+ * "uniVer": "√",
1106
+ * "unixVer": "3.9+"
1107
+ * },
1108
+ * "ios": {
1109
+ * "osVer": "12.0",
1110
+ * "uniVer": "√",
1111
+ * "unixVer": "4.11"
1112
+ * },
1113
+ * "harmony": {
1114
+ * "osVer": "3.0",
1115
+ * "uniVer": "4.23",
1116
+ * "unixVer": "x"
1117
+ * }
1118
+ * },
1119
+ * "web": {
1120
+ * "uniVer": "√",
1121
+ * "unixVer": "4.0"
1122
+ * }
1123
+ * }
1124
+ */
1125
+ url: string,
1126
+ /**
1127
+ * HTTP 请求 Header,header 中不能设置 Referer
1128
+ * @defaultValue null
1129
+ * @uniPlatform
1130
+ * {
1131
+ * "app": {
1132
+ * "android": {
1133
+ * "osVer": "5.0",
1134
+ * "uniVer": "√",
1135
+ * "unixVer": "3.9+"
1136
+ * },
1137
+ * "ios": {
1138
+ * "osVer": "12.0",
1139
+ * "uniVer": "√",
1140
+ * "unixVer": "4.11"
1141
+ * }
1142
+ * }
1143
+ * }
1144
+ */
1145
+ header?: UTSJSONObject | null,
1146
+ /**
1147
+ * 指定文件下载路径
1148
+ * 支持相对路径与绝对路径,例:
1149
+ * `/imgs/pic.png`、`/storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/temp/imgs/pic.png`
1150
+ * 并且支持指定下载目录,例:
1151
+ * `/imgs/`
1152
+ * 支持uni.env的平台兼容性:Android自3.9开始支持uni.env,iOS自4.13开始支持uni.env
1153
+ * @defaultValue null
1154
+ * @uniPlatform
1155
+ * {
1156
+ * "app": {
1157
+ * "android": {
1158
+ * "osVer": "5.0",
1159
+ * "uniVer": "√",
1160
+ * "unixVer": "3.9+"
1161
+ * },
1162
+ * "ios": {
1163
+ * "osVer": "12.0",
1164
+ * "uniVer": "√",
1165
+ * "unixVer": "4.11"
1166
+ * },
1167
+ * "harmony": {
1168
+ * "osVer": "3.0",
1169
+ * "uniVer": "4.23",
1170
+ * "unixVer": "x"
1171
+ * }
1172
+ * },
1173
+ * "web": {
1174
+ * "uniVer": "√",
1175
+ * "unixVer": "4.0"
1176
+ * }
1177
+ * }
1178
+ */
1179
+ filePath?: string | null,
1180
+ /**
1181
+ * 超时时间,单位 ms
1182
+ * @defaultValue 120000
1183
+ * @uniPlatform
1184
+ * {
1185
+ * "app": {
1186
+ * "android": {
1187
+ * "osVer": "5.0",
1188
+ * "uniVer": "",
1189
+ * "unixVer": "3.9+"
1190
+ * },
1191
+ * "ios": {
1192
+ * "osVer": "12.0",
1193
+ * "uniVer": "",
1194
+ * "unixVer": "4.11"
1195
+ * },
1196
+ * "harmony": {
1197
+ * "osVer": "3.0",
1198
+ * "uniVer": "4.23",
1199
+ * "unixVer": "x"
1200
+ * }
1201
+ * },
1202
+ * "web": {
1203
+ * "uniVer": "",
1204
+ * "unixVer": "4.0"
1205
+ * }
1206
+ * }
1207
+ */
1208
+ timeout?: number | null,
1209
+ /**
1210
+ * 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'}
1211
+ * @defaultValue null
1212
+ */
1213
+ success?: DownloadFileSuccessCallback | null,
1214
+ /**
1215
+ * 失败的回调函数
1216
+ * @defaultValue null
1217
+ */
1218
+ fail?: DownloadFileFailCallback | null,
1219
+ /**
1220
+ * 结束的回调函数(调用成功、失败都会执行)
1221
+ * @defaultValue null
1222
+ */
1223
+ complete?: DownloadFileCompleteCallback | null
1224
+ };
1225
+ export type OnProgressDownloadResult = {
1226
+ /**
1227
+ * 下载进度百分比
1228
+ * @uniPlatform
1229
+ * {
1230
+ * "app": {
1231
+ * "android": {
1232
+ * "osVer": "5.0",
1233
+ * "uniVer": "√",
1234
+ * "unixVer": "3.9+"
1235
+ * },
1236
+ * "ios": {
1237
+ * "osVer": "12.0",
1238
+ * "uniVer": "√",
1239
+ * "unixVer": "4.11"
1240
+ * },
1241
+ * "harmony": {
1242
+ * "osVer": "3.0",
1243
+ * "uniVer": "4.23",
1244
+ * "unixVer": "x"
1245
+ * }
1246
+ * },
1247
+ * "web": {
1248
+ * "uniVer": "√",
1249
+ * "unixVer": "4.0"
1250
+ * }
1251
+ * }
1252
+ */
1253
+ progress: number,
1254
+ /**
1255
+ * 已经下载的数据长度,单位 Bytes
1256
+ * @uniPlatform
1257
+ * {
1258
+ * "app": {
1259
+ * "android": {
1260
+ * "osVer": "5.0",
1261
+ * "uniVer": "√",
1262
+ * "unixVer": "3.9+"
1263
+ * },
1264
+ * "ios": {
1265
+ * "osVer": "12.0",
1266
+ * "uniVer": "√",
1267
+ * "unixVer": "4.11"
1268
+ * },
1269
+ * "harmony": {
1270
+ * "osVer": "3.0",
1271
+ * "uniVer": "4.23",
1272
+ * "unixVer": "x"
1273
+ * }
1274
+ * },
1275
+ * "web": {
1276
+ * "uniVer": "",
1277
+ * "unixVer": "4.0"
1278
+ * }
1279
+ * }
1280
+ */
1281
+ totalBytesWritten: number,
1282
+ /**
1283
+ * 预期需要下载的数据总长度,单位 Bytes
1284
+ * @uniPlatform
1285
+ * {
1286
+ * "app": {
1287
+ * "android": {
1288
+ * "osVer": "5.0",
1289
+ * "uniVer": "√",
1290
+ * "unixVer": "3.9+"
1291
+ * },
1292
+ * "ios": {
1293
+ * "osVer": "12.0",
1294
+ * "uniVer": "√",
1295
+ * "unixVer": "4.11"
1296
+ * },
1297
+ * "harmony": {
1298
+ * "osVer": "3.0",
1299
+ * "uniVer": "4.23",
1300
+ * "unixVer": "x"
1301
+ * }
1302
+ * },
1303
+ * "web": {
1304
+ * "uniVer": "√",
1305
+ * "unixVer": "4.0"
1306
+ * }
1307
+ * }
1308
+ */
1309
+ totalBytesExpectedToWrite: number
1310
+ };
1311
+ export type DownloadFileProgressUpdateCallback = (result: OnProgressDownloadResult) => void;
1312
+ export interface DownloadTask {
1313
+ /**
1314
+ * 中断下载任务
1315
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
1316
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
1317
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
1318
+ * @uniPlatform
1319
+ * {
1320
+ * "app": {
1321
+ * "android": {
1322
+ * "osVer": "4.4",
1323
+ * "uniVer": "√",
1324
+ * "unixVer": "3.9+"
1325
+ * },
1326
+ * "ios": {
1327
+ * "osVer": "12.0",
1328
+ * "uniVer": "√",
1329
+ * "unixVer": "4.11"
1330
+ * },
1331
+ * "harmony": {
1332
+ * "osVer": "3.0",
1333
+ * "uniVer": "4.23",
1334
+ * "unixVer": "x"
1335
+ * }
1336
+ * },
1337
+ * "web": {
1338
+ * "uniVer": "√",
1339
+ * "unixVer": "4.0"
1340
+ * }
1341
+ * }
1342
+ * @example
1343
+ ```typescript
1344
+ var downloadTask = uni.downloadFile({
1345
+ url: 'https://www.example.com/file/test', //仅为示例,并非真实接口地址。
1346
+ complete: ()=> {}
1347
+ });
1348
+ downloadTask.abort();
1349
+ ```
1350
+ */
1351
+ abort(): void,
1352
+ /**
1353
+ * 监听下载进度变化。
1354
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
1355
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
1356
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
1357
+ * @uniPlatform
1358
+ * {
1359
+ * "app": {
1360
+ * "android": {
1361
+ * "osVer": "4.4",
1362
+ * "uniVer": "√",
1363
+ * "unixVer": "3.9+"
1364
+ * },
1365
+ * "ios": {
1366
+ * "osVer": "12.0",
1367
+ * "uniVer": "√",
1368
+ * "unixVer": "4.11"
1369
+ * },
1370
+ * "harmony": {
1371
+ * "osVer": "3.0",
1372
+ * "uniVer": "4.23",
1373
+ * "unixVer": "x"
1374
+ * }
1375
+ * },
1376
+ * "web": {
1377
+ * "uniVer": "√",
1378
+ * "unixVer": "4.0"
1379
+ * }
1380
+ * }
1381
+ * @example
1382
+ ```typescript
1383
+ downloadTask.onProgressUpdate((res) => {
1384
+ console.log('下载进度' + res.progress);
1385
+ console.log('已经下载的数据长度' + res.totalBytesWritten);
1386
+ console.log('预期需要下载的数据总长度' + res.totalBytesExpectedToWrite);
1387
+ });
1388
+ ```
1389
+ */
1390
+ onProgressUpdate(callback: DownloadFileProgressUpdateCallback): void,
1391
+ };
1392
+
1393
+
1394
+ export interface Uni {
1395
+ /**
1396
+ * 发起网络请求。
1397
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/request.html
1398
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/request.html
1399
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/request.html
1400
+ * @uniPlatform
1401
+ * {
1402
+ * "app": {
1403
+ * "android": {
1404
+ * "osVer": "4.4",
1405
+ * "uniVer": "√",
1406
+ * "unixVer": "3.9+"
1407
+ * },
1408
+ * "ios": {
1409
+ * "osVer": "12.0",
1410
+ * "uniVer": "√",
1411
+ * "unixVer": "4.11"
1412
+ * },
1413
+ * "harmony": {
1414
+ * "osVer": "3.0",
1415
+ * "uniVer": "4.23",
1416
+ * "unixVer": "x"
1417
+ * }
1418
+ * },
1419
+ * "web": {
1420
+ * "uniVer": "√",
1421
+ * "unixVer": "4.0"
1422
+ * }
1423
+ * }
1424
+ * @example
1425
+ ```typescript
1426
+ uni.request({
1427
+ url: "http://192.168.12.106:8080/postHalo",
1428
+ dataType: "json",
1429
+ responseType: "json",
1430
+ method: "POST",
1431
+ data: {
1432
+ platform: "ios",
1433
+ },
1434
+ // header: {
1435
+ // "Content-Type": "application/json",
1436
+ // },
1437
+ timeout: 6000,
1438
+ sslVerify: false,
1439
+ withCredentials: false,
1440
+ firstIpv4: false,
1441
+ success(res) {
1442
+ console.log("success :", res.data);
1443
+ },
1444
+ fail(e) {
1445
+ console.log(e);
1446
+ },
1447
+ complete(res) {
1448
+ console.log("complete :", res);
1449
+ },
1450
+ });
1451
+ ```
1452
+ */
1453
+ request<T>(param: RequestOptions<T>): RequestTask;
1454
+ /**
1455
+ * 将本地资源上传到开发者服务器。
1456
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
1457
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
1458
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
1459
+ * @uniPlatform
1460
+ * {
1461
+ * "app": {
1462
+ * "android": {
1463
+ * "osVer": "4.4",
1464
+ * "uniVer": "",
1465
+ * "unixVer": "3.9+"
1466
+ * },
1467
+ * "ios": {
1468
+ * "osVer": "12.0",
1469
+ * "uniVer": "",
1470
+ * "unixVer": "4.11"
1471
+ * },
1472
+ * "harmony": {
1473
+ * "osVer": "3.0",
1474
+ * "uniVer": "4.23",
1475
+ * "unixVer": "x"
1476
+ * }
1477
+ * },
1478
+ * "web": {
1479
+ * "uniVer": "",
1480
+ * "unixVer": "4.0"
1481
+ * }
1482
+ * }
1483
+ * @example
1484
+ ```typescript
1485
+ uni.uploadFile({
1486
+ url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,非真实的接口地址
1487
+ filePath: "/static/logo.png",
1488
+ name: 'file',
1489
+ formData: {
1490
+ 'user': 'test'
1491
+ },
1492
+ success: (uploadFileRes) => {
1493
+ console.log(uploadFileRes.data);
1494
+ }
1495
+ });
1496
+ ```
1497
+ */
1498
+ uploadFile(options: UploadFileOptions): UploadTask;
1499
+ /**
1500
+ * 下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。
1501
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
1502
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
1503
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
1504
+ * @uniPlatform
1505
+ * {
1506
+ * "app": {
1507
+ * "android": {
1508
+ * "osVer": "4.4",
1509
+ * "uniVer": "√",
1510
+ * "unixVer": "3.9+"
1511
+ * },
1512
+ * "ios": {
1513
+ * "osVer": "12.0",
1514
+ * "uniVer": "√",
1515
+ * "unixVer": "4.11"
1516
+ * },
1517
+ * "harmony": {
1518
+ * "osVer": "3.0",
1519
+ * "uniVer": "4.23",
1520
+ * "unixVer": "x"
1521
+ * }
1522
+ * },
1523
+ * "web": {
1524
+ * "uniVer": "√",
1525
+ * "unixVer": "4.0"
1526
+ * }
1527
+ * }
1528
+ * @example
1529
+ ```typescript
1530
+ uni.downloadFile({
1531
+ url: "http://192.168.12.106:8080/downloadfile",
1532
+ success(e) {
1533
+ console.log("success111 :", e);
1534
+ }
1535
+ });
1536
+ ```
1537
+ */
1538
+ downloadFile(options: DownloadFileOptions): DownloadTask;
1539
+ }