使用新版画布接口,显示设置画布宽高无效
initCanvas() {
const query = this.createSelectorQuery()
query.select('#canvas-handwriting').fields({
node: true,
size: true
}).exec(res => {
const {canvasWidth, canvasHeight} = this.data
canvas = res[0].node
console.log(res[0],this.data)
res[0].node.width= 600 // 该步骤设置完,模拟器显示仍为300
res[0].node.height = canvasHeight
ctx = canvas.getContext('2d')
ctx.fillStyle = "#07C160" //F7FBFF
ctx.fillRect(0, 0, 500, 500)
ctx.lineWidth = this.data._strokeWidth
ctx.scale(2,2)
})
},