[代码]onTakePhoto() {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]const ctx = wx.createCameraContext();[代码][代码] [代码][代码]ctx.takePhoto({[代码][代码] [代码][代码]quality: [代码][代码]'high'[代码][代码],[代码][代码] [代码][代码]success: (res) => {[代码][代码] [代码][代码]wx.compressImage({[代码][代码] [代码][代码]src: res.tempImagePath, [代码][代码]// 原图片路径[代码][代码] [代码][代码]quality: 50, [代码][代码]// 压缩质量,[代码][代码] [代码][代码]complete: compRes => {[代码][代码] [代码][代码]console.log(compRes.tempFilePath)[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]'form.compImg'[代码][代码]: compRes.tempFilePath[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]src: res.tempImagePath,[代码][代码] [代码][代码]'form.img'[代码][代码]: res.tempImagePath[代码][代码] [代码][代码]})[代码][代码] [代码][代码]console.log([代码][代码]'compImg:'[代码][代码], that.data.form.compImg)[代码][代码] [代码][代码]console.log([代码][代码]'orignImg:'[代码][代码], that.data.form.img)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码]异步回调里面 setData 不能用this,在回调外把this赋给一个变量
compressImage里setData无效[代码]wx.compressImage({[代码][代码] [代码][代码]src: res.tempImagePath, [代码][代码]// 原图片路径[代码][代码] [代码][代码]quality: 50, [代码][代码]// 压缩质量,[代码][代码] [代码][代码]complete: compRes => {[代码][代码] [代码][代码]console.log(compRes.tempFilePath)[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]'form.compImg'[代码][代码]: compRes.tempFilePath[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码]console.log(compRes.tempFilePath)能打印出来正确的临时路径,但是往form.compImg里赋值就是一直时undefined??
2019-03-21配置了,调试模式也不行
小程序webSocket客户端请求方式不正确,开发工具里面正确- 当前 Bug 的表现(可附上截图) 开发工具里面 [图片] 真机调试时: [图片] - 预期表现 - 复现路径 - 提供一个最简复现 Demo [图片]
2018-11-27