From 6a756e88264924a41f91259f393245535d535e4c Mon Sep 17 00:00:00 2001 From: ZakaryCode Date: Tue, 22 Sep 2020 20:13:32 +0800 Subject: [PATCH] fix(h5): api upload abort fix #7448 --- packages/taro-h5/src/api/fileTransfer/uploadFile.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/taro-h5/src/api/fileTransfer/uploadFile.js b/packages/taro-h5/src/api/fileTransfer/uploadFile.js index 814b3189379d..b487fb85bfdb 100644 --- a/packages/taro-h5/src/api/fileTransfer/uploadFile.js +++ b/packages/taro-h5/src/api/fileTransfer/uploadFile.js @@ -55,6 +55,7 @@ const createUploadTask = ({ url, filePath, fileName, formData, name, header, suc } xhr.onerror = e => { + clearTimeout(timeout) error({ errMsg: `${apiName}:fail ${e.message}` }) @@ -95,6 +96,7 @@ const createUploadTask = ({ url, filePath, fileName, formData, name, header, suc * 中断任务 */ const abort = () => { + clearTimeout(timeout) xhr.abort() }