优化新增串口
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
"use strict";
|
||||
const electron = require("electron");
|
||||
const path = require("path");
|
||||
const electron = require("electron");
|
||||
const { SerialPort } = require("serialport");
|
||||
SerialPort.list().then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
let win;
|
||||
electron.app.whenReady().then(() => {
|
||||
const win = new electron.BrowserWindow({
|
||||
win = new electron.BrowserWindow({
|
||||
title: "银收客",
|
||||
width: 1024,
|
||||
height: 768,
|
||||
@@ -46,15 +51,6 @@ electron.app.whenReady().then(() => {
|
||||
electron.ipcMain.on("printerInfoSync", (event, params) => {
|
||||
printWin.webContents.send("getParams", params);
|
||||
});
|
||||
electron.ipcMain.on("printStart", () => {
|
||||
printWin.webContents.printToPDF({}, (error, data) => {
|
||||
if (!error && data) {
|
||||
console.log("成功生成PDF");
|
||||
} else {
|
||||
console.error("无法生成PDF", error);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
electron.app.on("window-all-closed", () => {
|
||||
if (process.platform !== "darwin")
|
||||
|
||||
Reference in New Issue
Block a user