export type Request = (param: RequestOptions) => RequestTask; /** * 网络请求参数 */ export type RequestOptions = { /** * 开发者服务器接口地址 * * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ url: string, /** * 请求的参数 UTSJSONObject|string类型 * @type {RequestDataOptions} * @defaultValue null * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ data?: any | null, /** * 设置请求的 header,header 中不能设置 Referer * @defaultValue null * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ header?: UTSJSONObject | null, /** * 请求方法 * 如果设置的值不在取值范围内,会以GET方法进行请求。 * @type {RequestMethod} * @defaultValue "GET" * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ method?: RequestMethod | null, /** * 超时时间,单位 ms * @defaultValue 60000 * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * } * } */ timeout?: number | null, /** * 如果设为 json,会对返回的数据进行一次 JSON.parse,非 json 不会进行 JSON.parse * @defaultValue "json" * @deprecated 不支持 * @autodoc false */ dataType?: string | null, /** * 设置响应的数据类型。 * * @deprecated 不支持 * @autodoc false */ responseType?: string | null, /** * 验证 ssl 证书 * * @deprecated 不支持 * @autodoc false */ sslVerify?: boolean | null, /** * 跨域请求时是否携带凭证(cookies) * * @uniPlatform * { * "app": { * "android": { * "osVer": "4.4", * "uniVer": "√", * "unixVer": "x" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "x" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ withCredentials?: boolean | null, /** * DNS解析时优先使用ipv4 * @defaultValue false * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "x" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "x" * } * }, * "web": { * "uniVer": "x", * "unixVer": "x" * } * } */ firstIpv4?: boolean | null, /** * 网络请求成功回调。 * @defaultValue null */ success?: RequestSuccessCallback | null, /** * 网络请求失败回调。 * @defaultValue null */ fail?: RequestFailCallback | null, /** * 网络请求完成回调,成功或者失败都会调用。 * @defaultValue null */ complete?: RequestCompleteCallback | null } export type RequestSuccess = { /** * 开发者服务器返回的数据 * @type {RequestDataOptions} * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ data: T | null, /** * 开发者服务器返回的 HTTP 状态码 * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ statusCode: number, /** * 开发者服务器返回的 HTTP Response Header * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ header: any, /** * 开发者服务器返回的 cookies,格式为字符串数组 * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "x", * "unixVer": "x" * } * } */ cookies: Array } /** * 请求方法 * - GET GET方法请求一个指定资源的表示形式,使用 GET 的请求应该只被用于获取数据。 * - POST POST方法用于将实体提交到指定的资源,通常导致在服务器上的状态变化或副作用。 * - PUT PUT方法用有效载荷请求替换目标资源的所有当前表示。 * - PATCH PATCH方法用于对资源应用部分修改。 * - DELETE DELETE方法删除指定的资源。 * - HEAD HEAD方法请求一个与GET请求的响应相同的响应,但没有响应体。 * - OPTIONS OPTIONS 方法用于描述目标资源的通信选项。 */ export type RequestMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS"; /** * 错误码 * - 5 接口超时 * - 1000 服务端系统错误 * - 100001 json数据解析错误 * - 100002 错误信息json解析失败 * - 600003 网络中断 * - 600009 URL格式不合法 * - 602001 request系统错误 */ export type RequestErrorCode = 5 | 1000 | 100001 | 100002 | 600003 | 600009 | 602001; /** * 网络请求失败的错误回调参数 */ export interface RequestFail extends IUniError{ errCode: RequestErrorCode }; export type RequestSuccessCallback = (option: RequestSuccess) => void; export type RequestFailCallback = (option: RequestFail) => void; export type RequestCompleteCallback = (option: any) => void; export interface RequestTask { /** * abort() * @description * 中断网络请求。 * @param {void} * @return {void} * @tutorial https://uniapp.dcloud.net.cn/api/request/request.html#request * @uniPlatform * { * "app": { * "android": { * "osVer": "4.4", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } * @example ```typescript var requestTask = uni.request({ url: 'http://192.168.12.106:8080/postHalo', //仅为示例,并非真实接口地址。 complete: ()=> {} }); requestTask.abort(); ``` */ abort(): void } //===============================上传================================== export type UploadFile = (options: UploadFileOptions) => UploadTask; export type UploadFileOptionFiles = { /** * multipart 提交时,表单的项目名,默认为 file,如果 name 不填或填的值相同,可能导致服务端读取文件时只能读取到一个文件。 * @defaultValue "file" * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ name?: string | null, /** * 要上传文件资源的路径 * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "x", * "unixVer": "x" * } * } */ uri: string, /** * 要上传的文件对象 * @uniPlatform * { * "app": { * "android": { * "osVer": "4.4", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ file?: any | null }; export type UploadFileSuccess = { /** * 开发者服务器返回的数据 * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ data: string, /** * 开发者服务器返回的 HTTP 状态码 * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ statusCode: number }; export type UploadFileSuccessCallback = (result: UploadFileSuccess) => void; /** * 上传文件失败的错误回调参数 */ export interface UploadFileFail extends IUniError{ errCode: RequestErrorCode }; export type UploadFileFailCallback = (result: UploadFileFail) => void; export type UploadFileCompleteCallback = (result: any) => void; export type UploadFileOptions = { /** * 开发者服务器 url * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ url: string, /** * 要上传文件资源的路径, 支持uni.env * @defaultValue null * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ filePath?: string | null, /** * 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容 * @defaultValue null * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ name?: string | null, /** * 需要上传的文件列表。 * @defaultValue null * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ files?: (UploadFileOptionFiles[]) | null, /** * HTTP 请求 Header, header 中不能设置 Referer * @defaultValue null * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ header?: UTSJSONObject | null, /** * HTTP 请求中其他额外的 form data * @defaultValue null * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ formData?: UTSJSONObject | null, /** * 超时时间,单位 ms * @defaultValue 120000 * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ timeout?: number | null, /** * 成功返回的回调函数 * @defaultValue null */ success?: UploadFileSuccessCallback | null, /** * 失败的回调函数 * @defaultValue null */ fail?: UploadFileFailCallback | null, /** * 结束的回调函数(调用成功、失败都会执行) * @defaultValue null */ complete?: UploadFileCompleteCallback | null }; export type OnProgressUpdateResult = { /** * 上传进度百分比 * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ progress: number, /** * 已经上传的数据长度,单位 Bytes * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ totalBytesSent: number, /** * 预期需要上传的数据总长度,单位 Bytes * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ totalBytesExpectedToSend: number }; export type UploadFileProgressUpdateCallback = (result: OnProgressUpdateResult) => void export interface UploadTask { /** * abort() * @description * 中断上传任务。 * @param {void} * @return {void} * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile * @uniPlatform * { * "app": { * "android": { * "osVer": "4.4", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } * @example ```typescript var uploadTask = uni.uploadFile({ url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,并非真实接口地址。 complete: ()=> {} }); uploadTask.abort(); ``` */ abort(): void, /** * onProgressUpdate() * @description * 监听上传进度变化。 * @param {UploadFileProgressUpdateCallback} callback * @return {void} * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile * @uniPlatform * { * "app": { * "android": { * "osVer": "4.4", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } * @example ```typescript uploadTask.onProgressUpdate((res) => { console.log('上传进度' + res.progress); console.log('已经上传的数据长度' + res.totalBytesSent); console.log('预期需要上传的数据总长度' + res.totalBytesExpectedToSend); }); ``` */ onProgressUpdate(callback: UploadFileProgressUpdateCallback): void, }; //===============================下载================================== export type DownloadFile = (options: DownloadFileOptions) => DownloadTask; export type DownloadFileSuccess = { /** * 临时文件路径,下载后的文件会存储到一个临时文件 * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ tempFilePath: string, /** * 开发者服务器返回的 HTTP 状态码 * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ statusCode: number }; export type DownloadFileSuccessCallback = (result: DownloadFileSuccess) => void; /** * 下载文件失败的错误回调参数 */ export interface DownloadFileFail extends IUniError{ errCode: RequestErrorCode }; export type DownloadFileFailCallback = (result: DownloadFileFail) => void; export type DownloadFileComplete = any; export type DownloadFileCompleteCallback = (result: DownloadFileComplete) => void; export type DownloadFileOptions = { /** * 下载资源的 url * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ url: string, /** * HTTP 请求 Header,header 中不能设置 Referer * @defaultValue null * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * } * } */ header?: UTSJSONObject | null, /** * 指定文件下载路径 * 支持相对路径与绝对路径,例: * `/imgs/pic.png`、`/storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/temp/imgs/pic.png` * 并且支持指定下载目录,例: * `/imgs/` * 支持uni.env的平台兼容性:Android自3.9开始支持uni.env,iOS自4.13开始支持uni.env * @defaultValue null * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ filePath?: string | null, /** * 超时时间,单位 ms * @defaultValue 120000 * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ timeout?: number | null, /** * 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'} * @defaultValue null */ success?: DownloadFileSuccessCallback | null, /** * 失败的回调函数 * @defaultValue null */ fail?: DownloadFileFailCallback | null, /** * 结束的回调函数(调用成功、失败都会执行) * @defaultValue null */ complete?: DownloadFileCompleteCallback | null }; export type OnProgressDownloadResult = { /** * 下载进度百分比 * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ progress: number, /** * 已经下载的数据长度,单位 Bytes * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ totalBytesWritten: number, /** * 预期需要下载的数据总长度,单位 Bytes * @uniPlatform * { * "app": { * "android": { * "osVer": "5.0", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } */ totalBytesExpectedToWrite: number }; export type DownloadFileProgressUpdateCallback = (result: OnProgressDownloadResult) => void; export interface DownloadTask { /** * abort() * @description * 中断下载任务。 * @param {void} * @return {void} * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile * @uniPlatform * { * "app": { * "android": { * "osVer": "4.4", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } * @example ```typescript var downloadTask = uni.downloadFile({ url: 'https://www.example.com/file/test', //仅为示例,并非真实接口地址。 complete: ()=> {} }); downloadTask.abort(); ``` */ abort(): void, /** * onProgressUpdate() * @description * 监听下载进度变化。 * @param {DownloadFileProgressUpdateCallback} callback * @return {void} * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile * @uniPlatform * { * "app": { * "android": { * "osVer": "4.4", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } * @example ```typescript downloadTask.onProgressUpdate((res) => { console.log('下载进度' + res.progress); console.log('已经下载的数据长度' + res.totalBytesWritten); console.log('预期需要下载的数据总长度' + res.totalBytesExpectedToWrite); }); ``` */ onProgressUpdate(callback: DownloadFileProgressUpdateCallback): void, }; export interface Uni { /** * Request() * @description * 发起网络请求。 * @param {RequestOptions} options * @return {RequestTask} * @tutorial https://uniapp.dcloud.net.cn/api/request/request.html * @uniPlatform * { * "app": { * "android": { * "osVer": "4.4", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } * @example ```typescript uni.request({ url: "http://192.168.12.106:8080/postHalo", dataType: "json", responseType: "json", method: "POST", data: { platform: "ios", }, // header: { // "Content-Type": "application/json", // }, timeout: 6000, sslVerify: false, withCredentials: false, firstIpv4: false, success(res) { console.log("success :", res.data); }, fail(e) { console.log(e); }, complete(res) { console.log("complete :", res); }, }); ``` */ request(param: RequestOptions): RequestTask; /** * UploadFile() * @description * 将本地资源上传到开发者服务器。 * @param {UploadFileOptions} options * @return {UploadTask} * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile * @uniPlatform * { * "app": { * "android": { * "osVer": "4.4", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } * @example ```typescript uni.uploadFile({ url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,非真实的接口地址 filePath: "/static/logo.png", name: 'file', formData: { 'user': 'test' }, success: (uploadFileRes) => { console.log(uploadFileRes.data); } }); ``` */ uploadFile(options: UploadFileOptions): UploadTask; /** * DownloadFile() * @description * 下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。 * @param {DownloadFileOptions} options * @return {DownloadTask} * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile * @uniPlatform * { * "app": { * "android": { * "osVer": "4.4", * "uniVer": "√", * "unixVer": "3.9+" * }, * "ios": { * "osVer": "12.0", * "uniVer": "√", * "unixVer": "4.11" * } * }, * "web": { * "uniVer": "√", * "unixVer": "4.0" * } * } * @example ```typescript uni.downloadFile({ url: "http://192.168.12.106:8080/downloadfile", success(e) { console.log("success111 :", e); } }); ``` */ downloadFile(options: DownloadFileOptions): DownloadTask; }