Skip to main content
Version: Next

Taro.createCanvasContext(canvasId, component)

Creates a CanvasContext object.

Reference

Type

(canvasId: string, component?: Record<string, any>) => CanvasContext

Parameters

PropertyTypeDescription
canvasIdstringThe canvas-id property of the canvas component whose context needs to be obtained.
componentRecord<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

APIWeChat Mini-ProgramH5React Native
Taro.createCanvasContext✔️✔️