From 1ec26577981b2103ef76a26850be8204cd4181ab Mon Sep 17 00:00:00 2001 From: fofolee Date: Mon, 20 Jul 2020 19:06:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20showConfirmBox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/preload.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/preload.js b/src/preload.js index dd3bc9a..532edcd 100644 --- a/src/preload.js +++ b/src/preload.js @@ -276,6 +276,23 @@ quickcommand = { }); }, + showConfirmBox: function(title) { + return new Promise((reslove, reject) => { + let options = { + text: title, + icon: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: '确定!', + cancelButtonText: '手抖...', + } + Swal.fire(options).then(result => { + if (result.value) reslove() + }) + }); + }, + // 关闭进程 kill: function (pid, signal = 'SIGTERM') { process.kill(pid, signal)