优化样式 新增版本号
This commit is contained in:
@@ -7,9 +7,9 @@ app.whenReady().then(() => {
|
||||
width: 1024,
|
||||
height: 768,
|
||||
fullscreenable: true,
|
||||
fullscreen: false,
|
||||
fullscreen: process.env.VITE_DEV_SERVER_URL ? false : true,
|
||||
simpleFullscreen: true,
|
||||
frame: true,
|
||||
frame: process.env.VITE_DEV_SERVER_URL ? true : false,
|
||||
webPreferences: {
|
||||
// 集成网页和 Node.js,也就是在渲染进程中,可以调用 Node.js 方法
|
||||
nodeIntegration: true,
|
||||
@@ -41,6 +41,7 @@ app.whenReady().then(() => {
|
||||
// 创建打印小票子窗口
|
||||
const printWin = new BrowserWindow({
|
||||
show: false,
|
||||
width: 580,
|
||||
webPreferences: {
|
||||
// 集成网页和 Node.js,也就是在渲染进程中,可以调用 Node.js 方法
|
||||
nodeIntegration: true,
|
||||
@@ -55,19 +56,26 @@ app.whenReady().then(() => {
|
||||
printWin.loadFile(path.resolve(__dirname, '../dist/print.html')); // 打包后使用文件路径访问应用
|
||||
}
|
||||
|
||||
printWin.webContents.openDevTools()
|
||||
|
||||
ipcMain.on('printerInfoSync', (event, params) => {
|
||||
console.log(JSON.parse(params))
|
||||
// console.log(JSON.parse(params))
|
||||
printWin.webContents.send('getParams', params)
|
||||
})
|
||||
|
||||
// 执行打印操作
|
||||
ipcMain.on('printStart', () => {
|
||||
console.log('开始打印')
|
||||
printWin.webContents.print({
|
||||
silent: true
|
||||
// console.log('开始打印')
|
||||
|
||||
printWin.webContents.printToPDF({}, (error, data) => {
|
||||
if (!error && data) {
|
||||
console.log("成功生成PDF")
|
||||
} else {
|
||||
console.error("无法生成PDF", error)
|
||||
}
|
||||
})
|
||||
|
||||
// printWin.webContents.print({
|
||||
// silent: true
|
||||
// })
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user