deleteFileId 的值为 cloud://jsy-test-tk8xa.6a73-jsy-test-tk8xa-1258939113/storeCover-jsyf4244-1555987045932.jpg
deleteFileId 为之前 wx.cloud.uploadFile success的 res.fileID
console.log("typeof", (typeof deleteFileId))
wx.cloud.deleteFile({
fileList: [deleteFileId],
success: res => {
console.log("删除成功,fileList",res.fileList)
},
fail: err => {
console.log("删除失败,deleteFileId", deleteFileId,"err", err)
}
})
控制台打印:
typeof string
删除失败,deleteFileId
err Error: errCode: -401003 api parameter type error | errMsg: parameter.fileList[clone] should be string instead of function;
at new e (http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:195271)
at Object.t.assertType (http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:194254)
at http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:182499
at http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:182832
at http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:122438
at Object.next (http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:122543)
at http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:121481
at Promise (<anonymous>)
at Module.l (http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:121258)
at r (http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:182229)
at e.
at Object.exportAPI.(anonymous function) [as deleteFile] (http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:127385)
at http://127.0.0.1:30738/appservice/pages/store/store.js:306:20
at r (http://127.0.0.1:30738/appservice/utils/promise.js:1783:40)
at i._settlePromiseFromHandler (http://127.0.0.1:30738/appservice/utils/promise.js:1143:206)
at i._settlePromise (http://127.0.0.1:30738/appservice/utils/promise.js:1156:393)
感谢反馈,这是我们的内部 bug,是否是在 Array.prototype 上挂了 clone 方法?如果是的请先避免修改 Array.prototype,后续这个问题会修复
是的
谢谢!非常感谢,这个问题困扰了我两天,报错的内容我也反复的去想,但是就是没想过是因为 Array.prototype 上挂了 clone的原因。
抱歉这是我们的失误,让你困扰了这么久
请问您的问题解决了嘛,我也遇到了类似的问题,我的是把fileID存储到images数组中,然后点击获取到index后,使用fileList: [images[index]]来删除,也会报这个错误
错误提示说的很清楚了
console.log("typeof", (typeof deleteFileId))
打印的是 typeof string 数组中我是给的字符串啊
而且无论是我复制控制台打印的 deletefileId还是复制云开发控制台中文件的fileid 直接放到fileList中也是报这个错