this.uploadTask = uni.uploadFile({
...
this.uploadTask.abort() // 报错
- 发布:2024-11-06 21:22
- 更新:2024-11-06 21:22
- 阅读:31
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: M3 14.6.1
HBuilderX类型: 正式
HBuilderX版本号: 4.29
第三方开发者工具版本号: 1.06.2409140 darwin-arm64
基础库版本号: 3.6.4
项目创建方式: HBuilderX
示例代码:
操作步骤:
1.使用uploadFile上传文件到指定api
2.手动触发uploadtask.abort (我是放到onUnload中执行,预计页面返回中断上传)
3.结果查看console控制台报错
1.使用uploadFile上传文件到指定api
2.手动触发uploadtask.abort (我是放到onUnload中执行,预计页面返回中断上传)
3.结果查看console控制台报错
预期结果:
不报错,uploadFile直接被中断从而执行fail callback函数
不报错,uploadFile直接被中断从而执行fail callback函数
实际结果:
报错,继续执行uploadFile
报错,继续执行uploadFile
bug描述:
微信小程序 执行到 uploadTask.abort() 打印的错误 undefined is not an object (evaluating 'Im.get(this).promise')
具体如下
{message: "undefined is not an object (evaluating 'Im.get(this).promise')", line: 1, column: 967578, sourceURL: "https://lib/WAServiceMainContext.js", stack: "abort@https://lib/WAServiceMainContext.js:1:967578↵@https://usr//app-service.js:17094:55↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41733↵onUnload@[native code]↵onUnload@https://usr//app-service.js:17095:25↵onUnload@[native code]↵@https://usr//app-service.js:5668:18↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41733↵_o@[native code]↵_o@https://usr//app-service.js:5672:24↵@https://usr//app-service.js:5675:19↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41733↵yo@[native code]↵yo@https://usr//app-service.js:5683:24↵@https://usr//app-service.js:6017:17↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41733↵anonymous@[native code]↵@https://usr//app-service.js:6019:30↵@https://usr//app-service.js:7260:115↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41733↵anonymous@[native code]↵@https://usr//app-service.js:7262:28↵@https://usr//app-service.js:7262:32↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41733↵Qs@[native code]↵Qs@https://usr//app-service.js:7263:24↵@https://usr//app-service.js:7283:39↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41733↵anonymous@[native code]↵@https://usr//app-service.js:7284:28↵@https://lib/WASubContext.js:1:459750↵@[native code]↵@https://lib/WASubContext.js:1:459543↵@https://lib/WASubContext.js:1:473041↵@https://lib/WASubContext.js:1:431573↵@https://lib/WASubContext.js:1:476597↵@https://lib/WASubContext.js:1:431573↵@https://lib/WASubContext.js:1:477812↵@https://lib/WASubContext.js:1:431573↵Pr@https://lib/WASubContext.js:1:478656↵@https://lib/WASubContext.js:1:430607↵@https://lib/WAServiceMainContext.js:1:871322↵emitInternal@https://lib/WAServiceMainContext.js:1:876558↵tS@https://lib/WAServiceMainContext.js:1:1016508↵HH@https://lib/WAServiceMainContext.js:1:1349178↵O@https://lib/WAServiceMainContext.js:1:2137973↵@https://lib/WAServiceMainContext.js:1:2139250↵@https://lib/WAServiceMainContext.js:1:1296228↵@https://lib/WAServiceMainContext.js:1:871421↵emit@https://lib/WAServiceMainContext.js:1:876466↵@https://lib/WAServiceMainContext.js:1:877685↵@https://lib/WAServiceMainContext.js:1:867652↵@https://lib/WAServiceMainContext.js:1:858073↵emit@https://lib/WAServiceMainContext.js:1:339422↵emit@[native code]↵emit@https://lib/WAServiceMainContext.js:1:338794↵subscribeHandler@https://lib/WAServiceMainContext.js:1:347247↵@[native code]"}
0 个回复