From ea4bf4f87ac6a4c1538f16b82071b72c54227572 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Thu, 8 Dec 2022 10:08:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=A2=E6=88=B7=E7=AB=AF=E6=89=93?= =?UTF-8?q?=E5=BC=80=E5=87=BA=E7=8E=B0=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/electron.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/electron/electron.js b/electron/electron.js index 484ce1a30..28ff28274 100644 --- a/electron/electron.js +++ b/electron/electron.js @@ -15,6 +15,7 @@ const config = require('./package.json'); let mainWindow = null, mainTray = null, subWindow = [], + isReady = false, willQuitApp = false, devloadUrl = "", devloadCachePath = path.resolve(__dirname, ".devload"); @@ -171,6 +172,7 @@ if (!getTheLock) { utils.setShowWindow(mainWindow) }) app.on('ready', () => { + isReady = true // 创建主窗口 createMainWindow() // 创建托盘 @@ -209,9 +211,13 @@ if (!getTheLock) { app.on('activate', () => { if (BrowserWindow.getAllWindows().length === 0) { - createMainWindow() - } else if (!mainWindow.isVisible()) { - mainWindow.show() + if (isReady) { + createMainWindow() + } + } else if (mainWindow) { + if (!mainWindow.isVisible()) { + mainWindow.show() + } } })