electron 开发 - 初入
1、新建文件夹
2、 npm init
package.json:
{ "name": "clock", "version": "1.0.0", "description": "clock", "main": "main.js", "scripts": { "start": "electron .", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "trinity", "license": "ISC", "devDependencies": { "electron": "^7.1.5" } }
3、 npm install electron
4、main.js:
const electron = require('electron')
function createWindow () {
let win = new electron.BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
}
electron.app.on('ready', createWindow)
5、index.html:
<h1>app running</h1>
6、运行 npm start :

bingo!your first app is running now!
浙公网安备 33010602011771号