收藏
回答

canvas官方说与web一致,在模拟器中roundRect是可以正常渲染的,但是真机模式下就报错?

canvas中

createSelectorQuery()

        .select("#canvas")

        .fields({ node: true, size: true })

        .exec(res => {

          const canvas = res[0].node;

          const ctx = canvas.getContext("2d");


          const dpr = Taro.getSystemInfoSync().pixelRatio;

          canvas.width = res[0].width * dpr;

          canvas.height = res[0].height * dpr;

          ctx.beginPath();

          ctx.strokeStyle = "red";

          ctx.roundRect(100, 200, 80, 200, [40]);

          ctx.stroke();

        });

模拟器是可以正常运行的,但是真机模式下就会报以下的错误

回答关注问题邀请回答
收藏

2 个回答

  • Demons
    Demons
    2023-07-17

    请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2023-07-17
    有用
    回复
  • 123
    123
    2023-10-01

    哈哈哈,官方不支持,没法子,忍

    2023-10-01
    有用
    回复
登录 后发表内容