Commit 08c4f6d7 by zeven

修复没有打印机模块导致闪退问题

parent bbdc5272
{
"name": "zm-face-counter",
"version": "1.2.8",
"version": "1.2.9",
"private": true,
"scripts": {
"android": "react-native run-android",
......
......@@ -412,6 +412,14 @@ const CounterMixins = ComposeComponent => {
};
print = async () => {
const isConnected = await Printer.isConnected();
if (!isConnected) {
const success = await Printer.usbConnect();
if (!success) {
Toast.info('打印机模块未连接,无法打印');
return;
}
}
let total = 0;
let goods = [];
this.state.printer.map(v => {
......
......@@ -189,15 +189,15 @@ if (_Printer) {
await Printer.halfCut(); // 半切
},
};
(async () => {
// 修复没有打印机模块导致闪退问题
try {
const isConnected = await Printer.isConnected();
if (!isConnected) await Printer.usbConnect();
} catch (e) {
// do nothing
}
})();
// (async () => {
// // 修复没有打印机模块导致闪退问题
// try {
// const isConnected = await Printer.isConnected();
// if (!isConnected) await Printer.usbConnect();
// } catch (e) {
// // do nothing
// }
// })();
}
export default Printer;
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