From cda6e3e2c4fa056da960c46d2fe60bbd1b7e3793 Mon Sep 17 00:00:00 2001 From: lyc Date: Thu, 25 Jul 2024 09:12:52 +0800 Subject: [PATCH] edit --- src/main/index.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index 92cbb87..12395b8 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -4,8 +4,6 @@ import { electronApp, optimizer, is } from '@electron-toolkit/utils' import icon from '../../resources/icon.png?asset' import File from './file' -// const handleUpdate = require("./handleUpdate"); - File({ app, shell, BrowserWindow, ipcMain }) process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true' let mainWindow, loginWindow @@ -27,10 +25,13 @@ function createLoginWindow() { } }) // handleUpdate(loginWindow,ipcMain) - const loginURL = is.dev ? `http://localhost:5173/#/login` : join(__dirname, '../renderer/index.html') - loginWindow.loadURL(loginURL) - - + // const loginURL = is.dev ? `http://localhost:5173/#/login` : `file://${__dirname}/index.html/#/login` + // loginWindow.loadURL(loginURL) + if (is.dev && process.env['ELECTRON_RENDERER_URL']) { + loginWindow.loadURL('http://localhost:5173/#/login') + } else { + loginWindow.loadFile(join(__dirname, '../renderer/index.html'), {hash: 'login'}) + } loginWindow.webContents.openDevTools() loginWindow.once('ready-to-show', () => { @@ -113,6 +114,7 @@ async function createLinkWin(data) { // 初始化完成 app.on('ready', () => { + // 设置应用程序用户模型标识符 electronApp.setAppUserModelId('com.electron') @@ -170,6 +172,7 @@ app.on('ready', () => { }) createLoginWindow() + app.on('activate', function () { if (BrowserWindow.getAllWindows().length === 0) createLoginWindow() }) -- 2.44.0.windows.1