Commit 46a1ef94 by zeven

优化打印机连接

parent 03514c94
......@@ -120,8 +120,7 @@ const CounterMixins = ComposeComponent => {
await handleScan();
this.barcode = '';
});
const isConnected = await Printer.isConnected();
if (!isConnected) await Printer.usbConnect(); // 尝试连接打印机模块
this.printerConnect();
this.listen();
};
......@@ -132,6 +131,11 @@ const CounterMixins = ComposeComponent => {
KeyEvent.removeKeyUpListener();
};
printerConnect = async () => {
const isConnected = await Printer.isConnected();
if (!isConnected) await Printer.usbConnect(); // 尝试连接打印机模块
};
setDelay = debounce(delay, true, () => {
this.isDelay = true;
setTimeout(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment