在wx.createCamera的回调函数success或者complete中调用camra.takePhoto获取到的返回对象tempImagepath为undefinded.示例代码:
camera.takePhoto(“normal”).then(
res => {
console.log(`tempImagePath===${res.tempImagePath}`)
console.log(res)
}
)
延时调用camera.takePhoto是可以获取到tempImagePath. 示例代码:
setTimeout(
function () {
camera.takePhoto(“normal”).then(
res => {
console.log(`tempImagePath===${res.tempImagePath}`)
console.log(res)
}
)}, 1000)
但是感觉手动设置延时,并不是很准确,具体应该怎么判断什么时候可以调用camera.takePhoto