收藏
回答

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 个回答

  • 好哇你个狗东西
    好哇你个狗东西
    2018-08-18

    同遇到这个问题,draw()的回调不执行

    2018-08-18
    有用
    回复
  • Jeff
    Jeff
    2018-08-09

    同遇到,不执行

    2018-08-09
    有用
    回复
  • 瑰意琦行
    瑰意琦行
    2018-07-30

    同问,ios可以缓存下来,没有问题,安卓总是不行,并且保存图片的时候红米和华为mate10经常出现只保存了图片的一个角落的图

    2018-07-30
    有用
    回复
  • mss。
    mss。
    2018-07-27

    同样的问题,安卓ctx.draw回调不执行

    2018-07-27
    有用
    回复 1
    • 蜗牛
      蜗牛
      2018-08-07

      解决了吗?回调不执行的问题

      2018-08-07
      回复
  • 疯狂的小辣椒
    疯狂的小辣椒
    2018-07-27

    你好,请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2018-07-27
    有用
    回复 2
    • 2018-11-28

      同遇到安卓draw不执行的问题,希望官方能查看一下。cover-view在安卓上覆盖不住canvas,转图片又转不成功。。。

      2018-11-28
      回复
    • 疯狂的小辣椒
      疯狂的小辣椒
      2018-11-28回复

      建议单独发帖哈。提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html),好跟进问题

      2018-11-28
      回复
  • 2018-07-27

    而且mainCtx.draw(true, () => {这行直接没执行 也就是说 没有报错信息也没有执行fail回调

    2018-07-27
    有用
    回复
登录 后发表内容