unipp 使用uni.createCanvasContext画图

官网uni.createCanvasContext有详细介绍

<button @click="getImg">生成海报</button>
<view class="" style="opacity: 1;">
			<canvas class="canvas" canvas-id="firstCanvas" id="firstCanvas"></canvas>
		</view>
getImg(){
const ctx = uni.createCanvasContext('firstCanvas');
ctx.drawImage('/static/canvas.png', 0, 0, uni.upx2px(420), uni.upx2px(800));


ctx.save();
ctx.beginPath();
ctx.arc(uni.upx2px(100), uni.upx2px(80), uni.upx2px(50), 0, 2 * Math.PI);
ctx.translate(uni.upx2px(110), uni.upx2px(30));
ctx.clip();
ctx.drawImage(this.user.picture2, uni.upx2px(50), uni.upx2px(30), uni.upx2px(100), uni.upx2px(100));
ctx.restore();

ctx.draw()
}