diff --git a/components/TextToHex/textToDotMatrixFor7305.vue b/components/TextToHex/textToDotMatrixFor7305.vue index 53661d0..3c6fc5e 100644 --- a/components/TextToHex/textToDotMatrixFor7305.vue +++ b/components/TextToHex/textToDotMatrixFor7305.vue @@ -149,26 +149,28 @@ // 5. 异步绘制并获取像素数据(串行处理避免冲突) await new Promise((resolve, reject) => { ctx.draw(false, () => { - uni.canvasGetImageData({ - canvasId: 'reusableCanvas', - x: 0, - y: 0, - width: this.currentCanvasWidth, - height: this.currentCanvasHeight, - success: res => { - result = { - line: textLine, - pixelData: res.data, - width: this.currentCanvasWidth, - height: this.currentCanvasHeight - }; - resolve(); - }, - fail: err => { - // console.error(`处理第${i+1}行失败:`, err); - reject(err) - } - }); + setTimeout(() => { + uni.canvasGetImageData({ + canvasId: 'reusableCanvas', + x: 0, + y: 0, + width: this.currentCanvasWidth, + height: this.currentCanvasHeight, + success: res => { + result = { + line: textLine, + pixelData: res.data, + width: this.currentCanvasWidth, + height: this.currentCanvasHeight + }; + resolve(); + }, + fail: err => { + // console.error(`处理第${i+1}行失败:`, err); + reject(err) + } + }); + }, 100); }); });