收藏
回答

canvasToTempFilePath 安卓无法执行 iOS正常

框架类型 问题类型 API/组件名称 终端类型 操作系统 微信版本 基础库版本
小程序 Bug canvasToTempFilePath 客户端 Android 6.6.7 2.2.1

家中两部安卓

一部魅蓝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,

            success: (res) => {

// 安卓上执行到这一步没反应 打印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 个回答

登录 后发表内容