createSelectorQuery 在正式发布版中无法进入回调,体验版可以
发布于 6 年前 作者 natian 13186 次浏览 来自 问答
 createNewImg: function () {
    let t = this;
    const query = this.createSelectorQuery().in(this)
    query.select('#mycanvas').fields({
      node: true,
      size: true
    }).exec((res) => {
      console.log(res)
      const canvas = res[0].node
      const ctx = canvas.getContext('2d')
      // 绘制图片:图片居中显示在 canvas 中
      let imgWidth = t.data.imgWidth;
      let imgHeight = t.data.imgHeight;
      canvas.width = t.data.screen_width * t.data.ratio
      canvas.height = t.data.screen_height * t.data.ratio
      ctx.scale(11);
      let imageRatio = imgWidth / imgHeight
      if (imageRatio > 1.25)
        imageRatio = 1.25
      let x = 0.1 * t.data.screen_width * t.data.ratio;
      let y = (0.1 * t.data.screen_width * imageRatio + 30)
      let w = 0.8 * t.data.screen_width * t.data.ratio
      let h = (w / imageRatio)
      let textHeight = 100 * t.data.ratio;
      t.setData({
        x,
        y,
        w,
        h,
        textHeight,
        canvas,
        ctx,
      })
      t.drawBack(x, y, w, h, textHeight, canvas, ctx)
    })
  },
2 回复

你好,正式版有没有打开vconsole排查?

有打开,应该打出的日志并没有被打出,体验版可以打出

回到顶部