drawCanvas() {
var ctx = uni.createCanvasContext('myCanvas')
var that=this;
// begin path
ctx.rect(10, 10, 100, 30)
ctx.setFillStyle('yellow')
ctx.fill()
// begin another path
ctx.beginPath()
ctx.rect(10, 40, 100, 30)
// only fill this rect, not in current path
ctx.setFillStyle('blue')
ctx.fillRect(10, 70, 100, 30)
ctx.rect(10, 100, 100, 30)
// it will fill current path
ctx.setFillStyle('red')
ctx.fill()
ctx.draw(true, (() => {
setTimeout(()=>{
console.log('asas');
uni.canvasToTempFilePath({
x: 100,
y: 200,
width: 50,
height: 50,
destWidth: 100,
destHeight: 100,
canvasId: 'myCanvas',
success: function(res) {
// 在H5平台下,tempFilePath 为 base64
console.log(res.tempFilePath)
},
complete:function(res) {
console.log('c');
}
},that)
},1000);
})());
}
success 、complete、fail 都不执行。
3***@qq.com (作者)
谢谢。后测试,vue页面可以 nvue页面不行。
2025-05-26 15:49
3***@qq.com (作者)
是否能让nvue也支持?
2025-05-26 15:53
DCloud_UNI_yuhe
回复 3***@qq.com: nvue 已经不在维护了
2025-05-26 15:54