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.