以Promise风格调用: 支持
中断上传任务
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
taskId | number | 否 | 任务ID | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
属性 | 类型 | 说明 |
---|---|---|
errMsg | string |
const uploadTask = xhs.uploadFile({ url: 'http://example.xiaohongshu.com/upload', //仅为示例,非真实的接口地址 filePath: tempFilePaths[0], name: 'file', success (res){ const data = res.data //do something } }) uploadTask.abort()