canvas 2d 预览 不支持drawImage 另外一个实例的画布呢
开发工具可以
手机上预览这个方法不行: ctx1.drawImage(ctx.canvas,0,0)
const queryTwo = wx.createSelectorQuery()
queryTwo.select('#myCanvasTwo')
.fields({ node: true, size: true })
.exec((res) => {
console.log(res)
const canvas = res[0].node
var ctx = canvas.getContext('2d')
const query = wx.createSelectorQuery()
query.select('#myCanvas3')
.fields({ node: true, size: true })
.exec((res) => {
console.log(res)
const canvas1 = res[0].node
const ctx1 = canvas1.getContext('2d')
console.log(ctx1)
const dpr2 = wx.getSystemInfoSync().pixelRatio
canvas1.width = res[0].width * dpr2
canvas1.height = res[0].height * dpr2
console.log(dpr2)
console.log(ctx1)
console.log(canvas1.width)
console.log(canvas1.height)
console.log(ctx)
// ctx1.scale(dpr, dpr)
ctx1.drawImage(ctx.canvas,0,0)
})
})
1 回复