update
This commit is contained in:
27
electron/main.js
Normal file
27
electron/main.js
Normal file
@@ -0,0 +1,27 @@
|
||||
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();
|
||||
});
|
||||
Reference in New Issue
Block a user