renderToCanvas() {
const wxml = getWxml(this.data.info);//获取template
const style = getStyle(this.data.info)//获取canvas
const p1 = this.widget.renderToCanvas({ wxml, style })
p1.then((res) => {
this.container = res
this.extraImage()
})
},
extraImage() {
const p2 = this.widget.canvasToTempFilePath()
p2.then(res => {
this.setData({
src: res.tempFilePath,
width: this.container.layoutBox.width,
height: this.container.layoutBox.height
})
})
},
只有这两个方法没看到有关闭海报的方法
微信海报制作,能不能出一个详细的步骤操作视频?
通过wx:if或者hidden控制布局隐藏,这样试过么
query.select(`#${canvasId}`)
.fields({node: true, size: true})
.exec(res => {
const canvas = res[0].node
const ctx = canvas.getContext('2d')
canvas.width = res[0].width * dpr
canvas.height = res[0].height * dpr
ctx.scale(dpr, dpr)
this.ctx = ctx
this.canvas = canvas
})