收藏
回答

求大佬指点wx.cloud.deleteFile的正确用法,不知道是bug还是什

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.(http://127.0.0.1:30738/appservice/__dev__/WAService.js:1:182077)

    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)


回答关注问题邀请回答
收藏

3 个回答

  • 邓坤力
    邓坤力
    2019-04-23

    感谢反馈,这是我们的内部 bug,是否是在 Array.prototype 上挂了 clone 方法?如果是的请先避免修改 Array.prototype,后续这个问题会修复

    2019-04-23
    有用
    回复 3
    • 2019-04-23

      是的

      2019-04-23
      回复
    • 2019-04-23

      谢谢!非常感谢,这个问题困扰了我两天,报错的内容我也反复的去想,但是就是没想过是因为 Array.prototype 上挂了 clone的原因。

      2019-04-23
      回复
    • 邓坤力
      邓坤力
      2019-04-23回复

      抱歉这是我们的失误,让你困扰了这么久

      2019-04-23
      回复
  • Miru
    Miru
    2022-05-15

    请问您的问题解决了嘛,我也遇到了类似的问题,我的是把fileID存储到images数组中,然后点击获取到index后,使用fileList: [images[index]]来删除,也会报这个错误


    2022-05-15
    有用
    回复
  • 祺爸💎
    祺爸💎
    2019-04-23

    错误提示说的很清楚了

    parameter.fileList[clone] should be string instead of function

    2019-04-23
    有用
    回复 2
    • 2019-04-23

      console.log("typeof", (typeof deleteFileId))

      打印的是 typeof string 数组中我是给的字符串啊

      2019-04-23
      回复
    • 2019-04-23

      而且无论是我复制控制台打印的  deletefileId还是复制云开发控制台中文件的fileid 直接放到fileList中也是报这个错

      2019-04-23
      回复
登录 后发表内容