From b629d2ac966935f059480879ca607484e97fc230 Mon Sep 17 00:00:00 2001 From: 3136352472 <3136352472> Date: Mon, 20 Apr 2020 11:09:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E5=87=BA=E5=88=B0=E6=89=98=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.js | 11 +++++++---- lib/tray.js | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5d0bee3..5d85ae0 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,9 +23,12 @@ exports.createMainWindow = function () { exports.MainWindow.hide(); }); - // mainWindow.on("close",function(event){ - // event.preventDefault(); - // mainWindow.hide(); - // }) + exports.MainWindow.isClose = false; + exports.MainWindow.on("close", function (event) { + if (!exports.MainWindow.isClose) { + event.preventDefault(); + exports.MainWindow.hide(); + } + }) } diff --git a/lib/tray.js b/lib/tray.js index d0736a7..183ad58 100644 --- a/lib/tray.js +++ b/lib/tray.js @@ -234,7 +234,7 @@ ipcMain.on('put-in-tray', (event) => { }, { label: "退出", click: function () { - + mainwin.MainWindow.isClose = true; app.quit() } })))