门禁端网页独立出来,全屏功能修好
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user