canvasToTempFilePath 安卓无法执行 iOS正常
家中两部安卓
一部魅蓝note5
一部小米MIX2
版本都是微信版本 6.6.7
2.2.1 在canvasPutImageData的 success回调中执行draw 后无法再次执行canvasToTempFilePath
但是IOS上的基础库版本2.1.3 微信版本6.6.7 相同的代码却正常执行
let windowSize = this .windowSize let bookmark = this .bookmark let mainCtx = this .mainCtx let $store = this .$store let that = this wx.canvasGetImageData({ canvasId: 'canvas' , x: 0, y: ((windowSize.windowHeight * 0.9) - bookmark.backgroundImage.style.height) / 2, width: windowSize.windowWidth, height: bookmark.backgroundImage.style.height, success (res) { let d = res.data let filterData = filters[type](d, { height: bookmark.backgroundImage.style.height, width: bookmark.backgroundImage.style.width }) wx.canvasPutImageData({ canvasId: 'canvas' , data: filterData, x: 0, y: ((windowSize.windowHeight * 0.9) - bookmark.backgroundImage.style.height) / 2, width: windowSize.windowWidth, height: bookmark.backgroundImage.style.height,
// 安卓上执行到这一步没反应 打印mainCtx也有对象 iOS正常 mainCtx.draw( true , () => { console.log(wx) wx.canvasToTempFilePath({ canvasId: 'canvas' , height: windowSize.windowHeight * 0.9, y: 0, success: (e) => { console.log(e) $store.dispatch( 'SET_BACKGROUND_IMAGE' , e.tempFilePath) }, fail: (e) => { }, complete: (e) => { console.log( 'complete' ) } }, that) }) } }) } }) |
我提交到体验版了 不知管理员能不能直接打开体验版查一下问题
6 回复
你好,请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。