html52.com
我爱小程序-开发者交流社区

createOffscreenCanvas 返回一个未定义的 getContext

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug createOffscreenCanvas, getContext 微信iOS客户端 8.0.14 2.20.1

https://developers.weixin.qq.com/miniprogram/en/dev/api/canvas/wx.createOffscreenCanvas.html

Code:

    // Create Off Screen 2D canvas Example
    const canvas = wx.createOffscreenCanvas({type: '2d', width: 300, height: 150})
    // Obtain context。 Note that this must be consistent with the type Agreement
    const context = canvas.getContext('2d')
    
    console.log("====");
    console.log(context);

Output:

====
[sm]:61 undefined


评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付