模板:
<canvas
canvas-id="canvasid"
:style="{width:100%, height: 100%}"
/>
js:
let ctx = uni.createCanvasContext('canvasid', this);
ctx.drawImage(imgPath, 0, 0, 500, 500, 0, 0);
setTimeout(() => {
uni.canvasToTempFilePath({
canvasId: 'canvasid',
success: (res) => {
console.log('res.tempFilePath', res.tempFilePath)
},
fail: (err) => {
console.log('uni.canvasToTempFilePath海报生成错误', err);
}
}, this);
}, 3000);
1 个回复
reverspring - 没什么好说的
请问修改的是那部分的代码