优化样式

This commit is contained in:
gyq
2024-03-08 15:04:11 +08:00
parent 6e3a4c5ce3
commit 11290d1505
15 changed files with 114 additions and 96 deletions

View File

@@ -1,10 +1,5 @@
import path from "path";
import { app, BrowserWindow, ipcMain } from "electron";
const { SerialPort } = require("serialport");
SerialPort.list().then(res => {
console.log(res);
});
let win;
app.whenReady().then(() => {
@@ -47,7 +42,6 @@ app.whenReady().then(() => {
// 创建打印小票子窗口
const printWin = new BrowserWindow({
show: false,
width: 580,
webPreferences: {
// 集成网页和 Node.js也就是在渲染进程中可以调用 Node.js 方法
nodeIntegration: true,
@@ -62,18 +56,27 @@ app.whenReady().then(() => {
printWin.loadFile(path.resolve(__dirname, "../dist/print.html")); // 打包后使用文件路径访问应用
}
// win.webContents.getPrintersAsync().then(res => {
// console.log('list', res)
// })
ipcMain.on("printerInfoSync", (event, params) => {
// console.log(JSON.parse(params))
printWin.webContents.send("getParams", params);
});
// 执行打印操作
// ipcMain.on('printStart', () => {
// console.log('开始打印')
// printWin.webContents.print({
// silent: true
// })
// })
ipcMain.on('printStart', () => {
console.log('开始打印')
let name = 'RONGTA 80mm Series Printer'
// printWin.webContents.print({
// silent: true,
// printBackground: true,
// deviceName: name
// })
})
});
app.on("window-all-closed", () => {