You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
"use strict";
|
|
const { app, BrowserWindow, screen } = require("electron");
|
|
const { join } = require("path");
|
|
process.env["ELECTRON_DISABLE_SECURITY_WARNINGS"] = "true";
|
|
const createWindow = () => {
|
|
const win = new BrowserWindow({
|
|
width: 800,
|
|
height: 600,
|
|
title: "沈阳华翔",
|
|
//标题
|
|
icon: join(__dirname, "../public/app.ico"),
|
|
//图标
|
|
// frame:false,//Frame是否可见
|
|
autoHideMenuBar: true
|
|
//隐藏菜单栏
|
|
});
|
|
const screenRect = screen.getPrimaryDisplay().bounds;
|
|
win.setBounds({
|
|
x: 0,
|
|
y: 0,
|
|
width: screenRect.width,
|
|
height: screenRect.height
|
|
});
|
|
console.log(process.env.npm_lifecycle_event);
|
|
if (process.env.VITE_DEV_SERVER_URL) {
|
|
win.loadURL(process.env.VITE_DEV_SERVER_URL);
|
|
win.webContents.openDevTools();
|
|
} else {
|
|
win.loadFile(join(__dirname, "../dist/index.html"));
|
|
}
|
|
};
|
|
app.whenReady().then(() => {
|
|
createWindow();
|
|
app.on("activate", () => {
|
|
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
|
});
|
|
});
|
|
app.on("window-all-closed", () => {
|
|
if (process.platform !== "darwin") app.quit();
|
|
});
|
|
|