Taro.createCanvasContext(canvasId, component)
Creates a CanvasContext object.
Type
(canvasId: string, component?: Record<string, any>) => CanvasContext
Parameters
| Property | Type | Description |
|---|---|---|
| canvasId | string | The canvas-id property of the canvas component whose context needs to be obtained. |
| component | Record<string, any> | In a custom component, the "this" of the current component instance means to search for the canvas with the canvas-id in this custom component. If this parameter is not specified, no search is performed in any custom component. |
API Support
| API | WeChat Mini-Program | H5 | React Native |
|---|---|---|---|
| Taro.createCanvasContext | ✔️ | ✔️ |