1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

门禁端网页独立出来,全屏功能修好

This commit is contained in:
2023-03-21 22:39:44 +08:00
parent 23dfc8288c
commit 5f4e20af66
15 changed files with 353 additions and 109 deletions

View File

@@ -1,10 +1,11 @@
const { app, BrowserWindow } = require('electron')
const { app, BrowserWindow, ipcMain, Menu, globalShortcut } = require('electron')
const { platform } = require('node:process')
const path = require('path')
console.log(`This platform is ${platform}`);
const createWindow = () => {
// 创建窗口
const mainWindow = new BrowserWindow({
width: 1080,
minWidth: 760,
@@ -15,13 +16,25 @@ const createWindow = () => {
},
})
// 加载 HTML
mainWindow.loadFile('html/index.html')
// 隐藏菜单栏
// let menu = Menu.getApplicationMenu()
Menu.setApplicationMenu(null)
// 全屏逻辑
// mainWindow.fullScreen = true;
//配置ESC键退出全屏
ipcMain.on('toggle-fullscreen', () => {
mainWindow.setFullScreen(!mainWindow.isFullScreen())
})
// 配置ESC键退出全屏
globalShortcut.register('ESC', () => {
mainWindow.setFullScreen(false);
})
// 调试窗口
// mainWindow.webContents.openDevTools()
}