修复蓝牙传输数据
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<canvas type="2d" canvas-id="reusableCanvas" :width="currentCanvasWidth" :height="currentCanvasHeight"
|
<canvas canvas-id="reusableCanvas" :width="currentCanvasWidth" :height="currentCanvasHeight"
|
||||||
class="offscreen-canvas"></canvas>
|
class="offscreen-canvas"></canvas>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -149,28 +149,26 @@
|
|||||||
// 5. 异步绘制并获取像素数据(串行处理避免冲突)
|
// 5. 异步绘制并获取像素数据(串行处理避免冲突)
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
ctx.draw(false, () => {
|
ctx.draw(false, () => {
|
||||||
setTimeout(() => {
|
uni.canvasGetImageData({
|
||||||
uni.canvasGetImageData({
|
canvasId: 'reusableCanvas',
|
||||||
canvasId: 'reusableCanvas',
|
x: 0,
|
||||||
x: 0,
|
y: 0,
|
||||||
y: 0,
|
width: this.currentCanvasWidth,
|
||||||
width: this.currentCanvasWidth,
|
height: this.currentCanvasHeight,
|
||||||
height: this.currentCanvasHeight,
|
success: res => {
|
||||||
success: res => {
|
result = {
|
||||||
result = {
|
line: textLine,
|
||||||
line: textLine,
|
pixelData: res.data,
|
||||||
pixelData: res.data,
|
width: this.currentCanvasWidth,
|
||||||
width: this.currentCanvasWidth,
|
height: this.currentCanvasHeight
|
||||||
height: this.currentCanvasHeight
|
};
|
||||||
};
|
resolve();
|
||||||
resolve();
|
},
|
||||||
},
|
fail: err => {
|
||||||
fail: err => {
|
// console.error(`处理第${i+1}行失败:`, err);
|
||||||
// console.error(`处理第${i+1}行失败:`, err);
|
reject(err)
|
||||||
reject(err)
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}, 100);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -202,6 +200,5 @@
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
left: -9999px;
|
left: -9999px;
|
||||||
top: -9999px;
|
top: -9999px;
|
||||||
visibility: hidden;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user