canvas.toTempFilePath(

发布于 8 年前作者 qiaojie15399 次浏览最后编辑 8 年前来自 ask
  • 当前 Bug 的表现

canvas.toTempFilePath({

           x: 0,

           y: 0,

           width: 100,

           height: 100,

           destWidth: 100,

           destHeight: 100,

           success: function (res) {

               const fs = wx.getFileSystemManager();

               fs.saveFile({

                   tempFilePath: res.tempFilePath,

                   success: function (suc_res) {

                       cc.log(suc_res)

                   },

                   fail: function (fail_res) {

                       cc.log(fail_res)

                   }

               })

           }

       })

  • 预期表现

   截图,并保存

  • 复现路径

   toTempFilePath成功后,saveFile 会fail ,提示文件not found,必现

1 回复
xfang
xfang1 楼6 年前

 wx.getFileSystemManager(); 这个是你独创的方法么?微信都没这个API

直接用wx.saveFile不就行了么?

上个res里面出来的tempPath是个数组。。你得取【0】才有值