根据代码提示的错误信息,看起来是因为在调用wx.cloud.uploadFile方法之后的代码中使用了"this.setData",但是在此处的作用域中无法使用"this"关键字。解决此问题的一种方法是将"this"关键字存储在一个变量中,然后在setTimeout函数中使用该变量。

可以尝试将以下代码更改为:

var that = this;
setTimeout(() => {
  that.setData({
    mailNumber: '', // 邮件编号
    images: [], // 保存的图片列表
    describe: '',
    searchData: {} // 存储查找到的数据
  });
}, 1000); // Add a delay of 1 second (adjust as needed)

这样,应该就可以解决wx报错的问题。

wxclouduploadFile cloudPath myImage + year + - + month + - + day + + new DategetTime + _ + MathfloorMathrandom 1000 + i + jpg filePath imagesi success function res consolelogUpload successful

原文地址: https://www.cveoy.top/t/topic/ijsy 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录