This commit is contained in:
2026-05-21 00:12:44 +08:00
commit 4ba2b730de
7 changed files with 171 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
const { app, BrowserWindow } = require('electron');
const path = require('path');
let win;
function createWindow() {
win = new BrowserWindow({
width: 500,
height: 400,
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
preload: path.join(__dirname, 'preload.js')
}
});
win.loadFile('index.html');
// 打开开发者工具方便调试
// win.webContents.openDevTools();
}
app.whenReady().then(createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});