1.绘制的图片呈现黑色背景(其实是因为背景是透明的)
// 在onLoad中执行
let that = this
//获取画布的大小信息
var sysInfo = wx.getSystemInfo({
success: function (res) {
canvasWidth1 = res.windowWidth * 0.9
canvasHeight1 = res.windowHeight * 0.8
ratio = res.windowWidth / 375
that.setData({
canvasWidth: canvasWidth1,
canvasHeight: canvasHeight1
})
},
})
//绘图的时候加上这句,其实就是绘制一个与画布等大的白色背景
ctx.setFillStyle('white');//然后就可以赋给fillStyle了
ctx.fillRect(0,0,this.data.canvasWidth,this.data.canvasHeight);
······
后续再更新~