# canvas组件 - [权限列表](#zh-cn_topic_0000001127284886_section11257113618419) - [子组件](#zh-cn_topic_0000001127284886_section9288143101012) - [属性](#zh-cn_topic_0000001127284886_section2907183951110) - [样式](#zh-cn_topic_0000001127284886_section5775351116) - [事件](#zh-cn_topic_0000001127284886_section1729055142211) - [方法](#zh-cn_topic_0000001127284886_section47669296127) - [示例](#zh-cn_topic_0000001127284886_section42931433142318) 提供画布组件。用于自定义绘制图形。 ## 权限列表 无 ## 子组件 不支持。 ## 属性 支持[通用属性](js-components-common-attributes.md#ZH-CN_TOPIC_0000001163812208)。 ## 样式 支持[通用样式](js-components-common-styles.md#ZH-CN_TOPIC_0000001163932190)。 ## 事件 支持[通用事件](js-components-common-events.md#ZH-CN_TOPIC_0000001209412119)。 ## 方法 除支持[通用方法](js-components-common-methods.md#ZH-CN_TOPIC_0000001209252157)外,还支持如下方法:
getContext ( type: '2d', attributes6+: { antialias: boolean } ) => CanvasRendering2dContext |
var ctx = canvas.getContext(contextType); var ctx = canvas.getContext(contextType, contextAttributes); 其中contextType为必填项,当前仅支持"2d",contextAttributes为可选参数,当前仅支持配置是否开启抗锯齿功能,默认为关闭。 获取canvas绘图上下文,参数仅支持“2d”,返回值为2D绘制对象,该对象提供具体的2D绘制操作。详见CanvasRenderingContext2D对象章节。 |
|
|