English
Canvas.
Attribute description
property name | type | default value | description | |
---|---|---|---|---|
canvas-id | String | Unique identifier for the canvas component | ||
disable-scroll | Boolean | false | When moving in the canvas and there is a bound gesture event, screen scrolling and pull-down refresh are prohibited | ByteDance applet and Feishu applet are not supported |
hidpi | Boolean | true | Enable HD processing | H5 (HBuilder X 3.4.0+), App-vue (HBuilder X 3.4.0+) |
@longtap | EventHandle | Triggered after a finger long press for 500ms, moving after the long press event is triggered will not trigger the scrolling of the screen | ByteDance applet and Feishu applet are not supported | |
@error | EventHandle | The error event is triggered when an error occurs, detail = {errMsg: 'something wrong'} | ByteDance applet and Feishu applet are not supported |
Notes:
Template
Script
<template>
<view>
<canvas style="width: 300px; height: 200px;" canvas-id="firstCanvas" id="firstCanvas"></canvas>
<canvas style="width: 400px; height: 500px;" canvas-id="secondCanvas" id="secondCanvas"></canvas>
<canvas style="width: 400px; height: 500px;" canvas-id="secondCanvas" id="secondCanvas" @error="canvasIdErrorCallback"></canvas>
</view>
</template>
Related api: uni.createCanvasContext
About chart