小程序开发文件上传遇到的坑

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/liwang2016384/article/details/86527649

图片上传

uplaodImg: function (imgurl, filePath){

wx.cloud.uploadFile({

imgurl,

filePath,

success: res => {

console.log('[上传文件] 成功:', res)

this.setData(imgUrl, res.fileID);

},

fail: e => {

console.error('[上传文件] 失败:', e)

wx.showToast({

icon: 'none',

title: '上传失败',

})

}

})

}

},

})

经过一番测试,把imgurl的名字改成cloudPath上传成功,就一个变量名的事情,坑死了

猜你喜欢

转载自blog.csdn.net/liwang2016384/article/details/86527649
今日推荐