From 291171aea7e6c6cf12d992f5e387bee8e9c743f8 Mon Sep 17 00:00:00 2001 From: gaoshuaixing <530353222@qq.com> Date: Mon, 17 Jan 2022 19:00:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=97=A0=E7=94=A8=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/config.js | 3 +-- preload.js | 12 ------------ renderer.js | 6 ------ 3 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 preload.js delete mode 100644 renderer.js diff --git a/electron/config.js b/electron/config.js index 3c5e6cb..664d3c3 100644 --- a/electron/config.js +++ b/electron/config.js @@ -38,8 +38,7 @@ const config = { webPreferences: { //webSecurity: false, contextIsolation: false, // 设置此项为false后,才可在渲染进程中使用electron api - nodeIntegration: true, - preload: path.join(__dirname, '../preload.js') + nodeIntegration: true }, frame: true, //titleBarStyle: 'hidden' diff --git a/preload.js b/preload.js deleted file mode 100644 index c2ff9c1..0000000 --- a/preload.js +++ /dev/null @@ -1,12 +0,0 @@ -// All of the Node.js APIs are available in the preload process. -// It has the same sandbox as a Chrome extension. -window.addEventListener('DOMContentLoaded', () => { - const replaceText = (selector, text) => { - const element = document.getElementById(selector) - if (element) element.innerText = text - } - - for (const type of ['chrome', 'node', 'electron']) { - replaceText(`${type}-version`, process.versions[type]) - } -}) diff --git a/renderer.js b/renderer.js deleted file mode 100644 index d3bdade..0000000 --- a/renderer.js +++ /dev/null @@ -1,6 +0,0 @@ -// This file is required by the index.html file and will -// be executed in the renderer process for that window. -// No Node.js APIs are available in this process because -// `nodeIntegration` is turned off. Use `preload.js` to -// selectively enable features needed in the rendering -// process.