# 画布组件

# 画布组件说明

组件 说明 最低版本
canvas 画布 1.0.0

基础库 2.12.1、iOS/安卓 2.35.1 起支持一套新 Canvas 2D 接口,支持开启原生渲染(需配置 native 属性)。相关 api:获取 canvas 实例。

# canvas

属性 类型 默认值 必填 说明 最低版本
id string 否 canvas 组件的唯一标识符
type string 2D 否
canvas-id string 否 canvas 组件的唯一标识符,若指定了 type 则无需再指定该属性
disable-scroll string 否 当在 canvas 中移动时且有绑定手势事件时,禁止屏幕滚动以及下拉刷新
native boolean false 否 使用原生渲染方式渲染 canvas
bindtouchstart eventhandle 否 手指触摸动作开始
bindtouchmove eventhandle 否 手指触摸后移动
bindtouchend eventhandle 否 手指触摸动作结束
bindtouchcancel eventhandle 否 手指触摸动作被打断,如来电提醒,弹窗
bindlongtap eventhandle 否 手指长按 500ms 之后触发,触发了长按事件后进行移动不会触发屏幕的滚动
binderror eventhandle 否 当发生错误时触发 error 事件,detail = {errMsg}
type string 否 指定 canvas 类型,支持 2d (2.9.0) 和 webgl (2.7.0) 不支持
hidpi boolean 否 开启 hidpi 渲染 独有