28 lines
648 B
JavaScript
28 lines
648 B
JavaScript
|
|
const {app, BrowserWindow} = require('electron')
|
||
|
|
const path = require("node:path");
|
||
|
|
|
||
|
|
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
|
||
|
|
|
||
|
|
let mainWindow;
|
||
|
|
const createWindow = () => {
|
||
|
|
mainWindow = new BrowserWindow({
|
||
|
|
width: 1000,
|
||
|
|
height: 1000,
|
||
|
|
frame: false,
|
||
|
|
center: true,
|
||
|
|
});
|
||
|
|
|
||
|
|
mainWindow.setMinimumSize(1000, 800);
|
||
|
|
|
||
|
|
if (app.isPackaged) { // 生产模式
|
||
|
|
mainWindow.loadFile('./dist/index.html').then();
|
||
|
|
} else {
|
||
|
|
mainWindow.webContents.openDevTools();
|
||
|
|
mainWindow.loadURL('http://localhost:5173').then();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
app.whenReady().then(() => {
|
||
|
|
createWindow();
|
||
|
|
});
|