12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- const { app, BrowserWindow, Menu, ipcRenderer } = require("electron");
- const createWindow = () => {
- const win = new BrowserWindow({
- fullscreen: true,
- autoHideMenuBar: true,
- });
- win.loadFile("./dist/index.html");
- const template = [
- {
- label: "文件",
- submenu: [{ label: "退出", role: "quit" }],
- },
- {
- label: "页面",
- submenu: [
- {
- label: "刷新",
- role: "reload",
- },
- {
- label: "主页",
- click: () => {
- win.loadFile("./dist/index.html", {
- hash: "/",
- });
- },
- },
- {
- label: "管理",
- click: async () => {
- win.loadFile("./dist/index.html", {
- hash: "/backend",
- });
- },
- },
- ],
- },
- {
- label: "开发",
- submenu: [{ label: "控制台", role: "toggleDevTools" }],
- },
- ];
- const menu = Menu.buildFromTemplate(template);
- Menu.setApplicationMenu(menu);
- };
- app.on("window-all-closed", () => {
- if (process.platform !== "darwin") app.quit();
- });
- app.whenReady().then(() => {
- const main = createWindow();
- });
|