@dcloudio/uni-app-x 0.7.19 → 0.7.21

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 (335) 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 -842
  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 +2048 -2047
  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 +2859 -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 +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 +240 -240
  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 -20
  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 +15 -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 +75 -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 +598 -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 -57
  86. package/types/uni/uts-plugin-api/index.d.ts +58 -57
  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-animationFrame/utssdk/global.d.ts +12 -12
  91. package/types/uni/uts-plugin-api/lib/uni-animationFrame/utssdk/index.d.ts +5 -5
  92. package/types/uni/uts-plugin-api/lib/uni-animationFrame/utssdk/interface.d.ts +50 -50
  93. package/types/uni/uts-plugin-api/lib/uni-arrayBufferToBase64/utssdk/global.d.ts +10 -10
  94. package/types/uni/uts-plugin-api/lib/uni-arrayBufferToBase64/utssdk/index.d.ts +4 -4
  95. package/types/uni/uts-plugin-api/lib/uni-arrayBufferToBase64/utssdk/interface.d.ts +77 -77
  96. package/types/uni/uts-plugin-api/lib/uni-authentication/utssdk/global.d.ts +60 -0
  97. package/types/uni/uts-plugin-api/lib/uni-authentication/utssdk/index.d.ts +29 -0
  98. package/types/uni/uts-plugin-api/lib/uni-authentication/utssdk/interface.d.ts +161 -0
  99. package/types/uni/uts-plugin-api/lib/uni-base64ToArrayBuffer/utssdk/global.d.ts +10 -10
  100. package/types/uni/uts-plugin-api/lib/uni-base64ToArrayBuffer/utssdk/index.d.ts +4 -4
  101. package/types/uni/uts-plugin-api/lib/uni-base64ToArrayBuffer/utssdk/interface.d.ts +77 -77
  102. package/types/uni/uts-plugin-api/lib/uni-canvas/utssdk/global.d.ts +20 -20
  103. package/types/uni/uts-plugin-api/lib/uni-canvas/utssdk/index.d.ts +9 -9
  104. package/types/uni/uts-plugin-api/lib/uni-canvas/utssdk/interface.d.ts +264 -242
  105. package/types/uni/uts-plugin-api/lib/uni-clipboard/utssdk/global.d.ts +40 -40
  106. package/types/uni/uts-plugin-api/lib/uni-clipboard/utssdk/index.d.ts +19 -19
  107. package/types/uni/uts-plugin-api/lib/uni-clipboard/utssdk/interface.d.ts +203 -203
  108. package/types/uni/uts-plugin-api/lib/uni-createInnerAudioContext/utssdk/global.d.ts +12 -12
  109. package/types/uni/uts-plugin-api/lib/uni-createInnerAudioContext/utssdk/index.d.ts +5 -5
  110. package/types/uni/uts-plugin-api/lib/uni-createInnerAudioContext/utssdk/interface.d.ts +1733 -1733
  111. package/types/uni/uts-plugin-api/lib/uni-createIntersectionObserver/utssdk/global.d.ts +20 -20
  112. package/types/uni/uts-plugin-api/lib/uni-createIntersectionObserver/utssdk/index.d.ts +9 -9
  113. package/types/uni/uts-plugin-api/lib/uni-createIntersectionObserver/utssdk/interface.d.ts +152 -152
  114. package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/global.d.ts +18 -18
  115. package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/index.d.ts +8 -8
  116. package/types/uni/uts-plugin-api/lib/uni-createRequestPermissionListener/utssdk/interface.d.ts +61 -61
  117. package/types/uni/uts-plugin-api/lib/uni-createSelectorQuery/utssdk/global.d.ts +20 -20
  118. package/types/uni/uts-plugin-api/lib/uni-createSelectorQuery/utssdk/index.d.ts +9 -9
  119. package/types/uni/uts-plugin-api/lib/uni-createSelectorQuery/utssdk/interface.d.ts +464 -427
  120. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/global.d.ts +12 -12
  121. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/index.d.ts +5 -5
  122. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/interface.d.ts +137 -137
  123. package/types/uni/uts-plugin-api/lib/uni-dialogPage/utssdk/global.d.ts +28 -28
  124. package/types/uni/uts-plugin-api/lib/uni-dialogPage/utssdk/index.d.ts +13 -13
  125. package/types/uni/uts-plugin-api/lib/uni-dialogPage/utssdk/interface.d.ts +1336 -1336
  126. package/types/uni/uts-plugin-api/lib/uni-event/utssdk/global.d.ts +16 -16
  127. package/types/uni/uts-plugin-api/lib/uni-event/utssdk/index.d.ts +7 -7
  128. package/types/uni/uts-plugin-api/lib/uni-event/utssdk/interface.d.ts +305 -305
  129. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/global.d.ts +26 -26
  130. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/index.d.ts +12 -12
  131. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/interface.d.ts +91 -91
  132. package/types/uni/uts-plugin-api/lib/uni-file/utssdk/global.d.ts +80 -80
  133. package/types/uni/uts-plugin-api/lib/uni-file/utssdk/index.d.ts +39 -39
  134. package/types/uni/uts-plugin-api/lib/uni-file/utssdk/interface.d.ts +174 -174
  135. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/global.d.ts +142 -142
  136. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/index.d.ts +70 -70
  137. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/interface.d.ts +1840 -1840
  138. package/types/uni/uts-plugin-api/lib/uni-getAccessibilityInfo/utssdk/global.d.ts +10 -10
  139. package/types/uni/uts-plugin-api/lib/uni-getAccessibilityInfo/utssdk/index.d.ts +4 -4
  140. package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/global.d.ts +12 -12
  141. package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/index.d.ts +5 -5
  142. package/types/uni/uts-plugin-api/lib/uni-getAppAuthorizeSetting/utssdk/interface.d.ts +329 -329
  143. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/global.d.ts +14 -14
  144. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/index.d.ts +6 -6
  145. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +818 -818
  146. package/types/uni/uts-plugin-api/lib/uni-getBackgroundAudioManager/utssdk/global.d.ts +12 -12
  147. package/types/uni/uts-plugin-api/lib/uni-getBackgroundAudioManager/utssdk/index.d.ts +5 -5
  148. package/types/uni/uts-plugin-api/lib/uni-getBackgroundAudioManager/utssdk/interface.d.ts +297 -297
  149. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/global.d.ts +14 -14
  150. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/index.d.ts +6 -6
  151. package/types/uni/uts-plugin-api/lib/uni-getDeviceInfo/utssdk/interface.d.ts +657 -657
  152. package/types/uni/uts-plugin-api/lib/uni-getElementById/utssdk/global.d.ts +10 -10
  153. package/types/uni/uts-plugin-api/lib/uni-getElementById/utssdk/index.d.ts +4 -4
  154. package/types/uni/uts-plugin-api/lib/uni-getElementById/utssdk/interface.d.ts +81 -81
  155. package/types/uni/uts-plugin-api/lib/uni-getEnterOptionsSync/utssdk/global.d.ts +12 -12
  156. package/types/uni/uts-plugin-api/lib/uni-getEnterOptionsSync/utssdk/index.d.ts +5 -5
  157. package/types/uni/uts-plugin-api/lib/uni-getEnterOptionsSync/utssdk/interface.d.ts +155 -155
  158. package/types/uni/uts-plugin-api/lib/uni-getLaunchOptionsSync/utssdk/global.d.ts +12 -12
  159. package/types/uni/uts-plugin-api/lib/uni-getLaunchOptionsSync/utssdk/index.d.ts +5 -5
  160. package/types/uni/uts-plugin-api/lib/uni-getLaunchOptionsSync/utssdk/interface.d.ts +159 -159
  161. package/types/uni/uts-plugin-api/lib/uni-getLocation/utssdk/global.d.ts +24 -24
  162. package/types/uni/uts-plugin-api/lib/uni-getLocation/utssdk/index.d.ts +11 -11
  163. package/types/uni/uts-plugin-api/lib/uni-getLocation/utssdk/interface.d.ts +563 -564
  164. package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/global.d.ts +8 -8
  165. package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/index.d.ts +4 -4
  166. package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/interface.d.ts +1 -1
  167. package/types/uni/uts-plugin-api/lib/uni-getLocation-tencent/utssdk/global.d.ts +8 -8
  168. package/types/uni/uts-plugin-api/lib/uni-getLocation-tencent/utssdk/index.d.ts +4 -4
  169. package/types/uni/uts-plugin-api/lib/uni-getNetworkType/utssdk/global.d.ts +32 -32
  170. package/types/uni/uts-plugin-api/lib/uni-getNetworkType/utssdk/index.d.ts +15 -15
  171. package/types/uni/uts-plugin-api/lib/uni-getPerformance/utssdk/global.d.ts +22 -22
  172. package/types/uni/uts-plugin-api/lib/uni-getPerformance/utssdk/index.d.ts +10 -10
  173. package/types/uni/uts-plugin-api/lib/uni-getPerformance/utssdk/interface.d.ts +163 -163
  174. package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/global.d.ts +30 -32
  175. package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/index.d.ts +14 -15
  176. package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/interface.d.ts +375 -375
  177. package/types/uni/uts-plugin-api/lib/uni-getRecorderManager/utssdk/global.d.ts +16 -16
  178. package/types/uni/uts-plugin-api/lib/uni-getRecorderManager/utssdk/index.d.ts +7 -7
  179. package/types/uni/uts-plugin-api/lib/uni-getRecorderManager/utssdk/interface.d.ts +980 -980
  180. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/global.d.ts +30 -30
  181. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/index.d.ts +14 -14
  182. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/interface.d.ts +2131 -2131
  183. package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/global.d.ts +12 -12
  184. package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/index.d.ts +5 -5
  185. package/types/uni/uts-plugin-api/lib/uni-getSystemSetting/utssdk/interface.d.ts +169 -169
  186. package/types/uni/uts-plugin-api/lib/uni-installApk/utssdk/global.d.ts +24 -24
  187. package/types/uni/uts-plugin-api/lib/uni-installApk/utssdk/index.d.ts +11 -11
  188. package/types/uni/uts-plugin-api/lib/uni-interceptor/utssdk/global.d.ts +16 -16
  189. package/types/uni/uts-plugin-api/lib/uni-interceptor/utssdk/index.d.ts +7 -7
  190. package/types/uni/uts-plugin-api/lib/uni-interceptor/utssdk/interface.d.ts +169 -169
  191. package/types/uni/uts-plugin-api/lib/uni-keyboard/utssdk/global.d.ts +22 -22
  192. package/types/uni/uts-plugin-api/lib/uni-keyboard/utssdk/index.d.ts +10 -10
  193. package/types/uni/uts-plugin-api/lib/uni-keyboard/utssdk/interface.d.ts +60 -60
  194. package/types/uni/uts-plugin-api/lib/uni-loadFontFace/utssdk/global.d.ts +26 -26
  195. package/types/uni/uts-plugin-api/lib/uni-loadFontFace/utssdk/index.d.ts +12 -12
  196. package/types/uni/uts-plugin-api/lib/uni-loadFontFace/utssdk/interface.d.ts +564 -564
  197. package/types/uni/uts-plugin-api/lib/uni-makePhoneCall/utssdk/global.d.ts +24 -24
  198. package/types/uni/uts-plugin-api/lib/uni-makePhoneCall/utssdk/index.d.ts +11 -11
  199. package/types/uni/uts-plugin-api/lib/uni-makePhoneCall/utssdk/interface.d.ts +100 -100
  200. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/global.d.ts +160 -160
  201. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/index.d.ts +79 -79
  202. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/interface.d.ts +1339 -1339
  203. package/types/uni/uts-plugin-api/lib/uni-navigationBar/utssdk/global.d.ts +68 -68
  204. package/types/uni/uts-plugin-api/lib/uni-navigationBar/utssdk/index.d.ts +33 -33
  205. package/types/uni/uts-plugin-api/lib/uni-navigationBar/utssdk/interface.d.ts +1002 -1002
  206. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/global.d.ts +72 -72
  207. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/index.d.ts +35 -35
  208. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/interface.d.ts +1493 -1493
  209. package/types/uni/uts-plugin-api/lib/uni-openAppAuthorizeSetting/utssdk/global.d.ts +24 -24
  210. package/types/uni/uts-plugin-api/lib/uni-openAppAuthorizeSetting/utssdk/index.d.ts +11 -11
  211. package/types/uni/uts-plugin-api/lib/uni-openDocument/utssdk/global.d.ts +24 -24
  212. package/types/uni/uts-plugin-api/lib/uni-openDocument/utssdk/index.d.ts +11 -11
  213. package/types/uni/uts-plugin-api/lib/uni-openDocument/utssdk/interface.d.ts +70 -70
  214. package/types/uni/uts-plugin-api/lib/uni-pageScrollTo/utssdk/global.d.ts +26 -26
  215. package/types/uni/uts-plugin-api/lib/uni-pageScrollTo/utssdk/index.d.ts +12 -12
  216. package/types/uni/uts-plugin-api/lib/uni-pageScrollTo/utssdk/interface.d.ts +153 -153
  217. package/types/uni/uts-plugin-api/lib/uni-payment/utssdk/global.d.ts +32 -32
  218. package/types/uni/uts-plugin-api/lib/uni-payment/utssdk/index.d.ts +15 -15
  219. package/types/uni/uts-plugin-api/lib/uni-payment/utssdk/interface.d.ts +240 -240
  220. package/types/uni/uts-plugin-api/lib/uni-payment-alipay/utssdk/global.d.ts +8 -8
  221. package/types/uni/uts-plugin-api/lib/uni-payment-alipay/utssdk/index.d.ts +4 -4
  222. package/types/uni/uts-plugin-api/lib/uni-payment-wxpay/utssdk/global.d.ts +8 -8
  223. package/types/uni/uts-plugin-api/lib/uni-payment-wxpay/utssdk/index.d.ts +4 -4
  224. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/global.d.ts +78 -74
  225. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/index.d.ts +38 -36
  226. package/types/uni/uts-plugin-api/lib/uni-prompt/utssdk/interface.d.ts +193 -8
  227. package/types/uni/uts-plugin-api/lib/uni-pullDownRefresh/utssdk/global.d.ts +28 -28
  228. package/types/uni/uts-plugin-api/lib/uni-pullDownRefresh/utssdk/index.d.ts +13 -13
  229. package/types/uni/uts-plugin-api/lib/uni-pullDownRefresh/utssdk/interface.d.ts +189 -189
  230. package/types/uni/uts-plugin-api/lib/uni-route/utssdk/global.d.ts +58 -58
  231. package/types/uni/uts-plugin-api/lib/uni-route/utssdk/index.d.ts +28 -28
  232. package/types/uni/uts-plugin-api/lib/uni-route/utssdk/interface.d.ts +2165 -2165
  233. package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/global.d.ts +10 -10
  234. package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/index.d.ts +4 -4
  235. package/types/uni/uts-plugin-api/lib/uni-rpx2px/utssdk/interface.d.ts +38 -38
  236. package/types/uni/uts-plugin-api/lib/uni-scanCode/utssdk/global.d.ts +24 -24
  237. package/types/uni/uts-plugin-api/lib/uni-scanCode/utssdk/index.d.ts +11 -11
  238. package/types/uni/uts-plugin-api/lib/uni-scanCode/utssdk/interface.d.ts +73 -73
  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 +1086 -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-websocket/utssdk/global.d.ts +58 -58
  250. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/index.d.ts +28 -28
  251. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/interface.d.ts +844 -844
  252. package/types/uni/uts-plugin-biz/global.d.ts +4 -4
  253. package/types/uni/uts-plugin-biz/index.d.ts +4 -4
  254. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/global.d.ts +36 -36
  255. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/index.d.ts +17 -17
  256. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/interface.d.ts +141 -141
  257. package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/global.d.ts +28 -28
  258. package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/index.d.ts +13 -13
  259. package/types/uni/uts-plugin-biz/lib/uni-facialRecognitionVerify/utssdk/interface.d.ts +160 -160
  260. package/types/uni/uts-plugin-biz/lib/uni-push/utssdk/global.d.ts +60 -60
  261. package/types/uni/uts-plugin-biz/lib/uni-push/utssdk/index.d.ts +29 -29
  262. package/types/uni/uts-plugin-biz/lib/uni-push/utssdk/interface.d.ts +808 -778
  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 -63
  317. package/types/uni-cloud/interface.d.ts +987 -991
  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/shim-uts-basic.d.ts +0 -4495
@@ -1,1493 +1,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
- * - 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
+ * - 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
+ }