<template>
<div>
<h3>Canvas2D点击清理按钮,清空所画内容 clearRect(x,y,w,h)(六)</h3>
<h3><el-button @click="click">清画布</el-button></h3>
<canvas id="canvas" width="600" height="600"></canvas>
</div>
</template>
<script>
export default {
name: "index",
data() {
return {};
},
methods: {
getRefreshCodeFun() {
//需求,清理画布 clearRect(x,y,w,h);
//获取cavans对象
var oCanvas = document.getElementById("canvas");
//获取按钮对象
if (oCanvas.getContext) {
//得到2d绘图上下文环境
var oContext = oCanvas.getContext("2d");
//更改填充颜色
oContext.fillStyle
Canvas2D点击清理按钮,清空所画内容 clearRect(x,y,w,h)(六)
最新推荐文章于 2024-03-26 15:37:50 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)