跳到主要内容
版本:3.x

Taro.createOffscreenCanvas(options)

创建离屏 canvas 实例

支持情况:

[参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html

有两个版本的写法:

  • createOffscreenCanvas(options) 从 2.16.1 起支持
  • createOffscreenCanvas(width, height, this) 从 2.7.0 起支持)

类型

(options: Option) => OffscreenCanvas

参数

参数类型
optionsOption

Option

参数类型默认值必填说明
type"webgl" or "2d": 'webgl'创建的离屏 canvas 类型
heightnumber画布高度
widthnumber画布宽度
componentTaroGeneral.IAnyObject在自定义组件下,当前组件实例的 this,以操作组件内 canvas 组件