新增设置面板

This commit is contained in:
2025-10-06 00:02:40 +08:00
parent 29d4152e81
commit c21319fe3c
13 changed files with 356 additions and 171 deletions

View File

@@ -1,11 +1,6 @@
import { app, BrowserWindow } from 'electron';
import * as path from 'path';
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require('electron-squirrel-startup')) {
app.quit();
}
const createWindow = () => {
// Create the browser window.
const mainWindow = new BrowserWindow({

View File

@@ -1,18 +1,13 @@
import { app, BrowserWindow, ipcMain } from 'electron';
import * as path from 'path';
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require('electron-squirrel-startup')) {
app.quit();
}
let mainWindow: BrowserWindow | null = null;
const createWindow = () => {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1200,
height: 800,
width: 1600,
height: 900,
frame: false, // 隐藏默认的窗口框架
icon: path.join(__dirname, '../../build/icon.ico'), // 设置应用图标
webPreferences: {
@@ -25,16 +20,15 @@ const createWindow = () => {
// and load the index.html of the app.
if (process.env.VITE_DEV_SERVER_URL) {
mainWindow.loadURL(process.env.VITE_DEV_SERVER_URL);
// 仅在开发环境中打开开发者工具
mainWindow.webContents.openDevTools();
} else {
// 使用绝对路径从项目根目录的 dist 文件夹加载
const indexPath = path.join(__dirname, '../../dist/index.html');
console.log('Loading index.html from:', indexPath);
mainWindow.loadFile(indexPath);
}
// Open the DevTools.
if (process.env.VITE_DEV_SERVER_URL) {
mainWindow.webContents.openDevTools();
// 在生产环境中确保关闭开发者工具
mainWindow.webContents.closeDevTools();
}
};