This repository has been archived on 2025-01-09. You can view files and clone it, but cannot push or open issues or pull requests.
2025-01-09 18:30:49 +08:00

36 lines
793 B
JavaScript

const { app, BrowserWindow } = require('electron')
function createWindow() {
let mainWin = new BrowserWindow({
x: 100, // 相对于屏幕左上角
y: 100,
show: false, // 防止首页白屏
width: 800,
height: 400,
maxHeight: 600, // 最大值
maxWidth: 1000,
minHeight: 200, // 最小值
minWidth: 300,
resizable: false // 固定大小,禁止缩放
})
// 防止首页白屏,否则不显示
mainWin.on('ready-to-show', () => {
mainWin.show()
})
mainWin.loadFile('index.html')
mainWin.on('close', () => {
mainWin = null // 删除引用,释放空间
})
}
app.on('ready', () => {
createWindow()
})
app.on('window-all-closed', () => {
app.quit()
})