安装环境
- 安装node npm cnpm tomcat
- 安装 visual studio 2017
- 安装 python27
- 安装 Squirrel.Windows
git bush中执行:
git clone --recursive https://github.com/squirrel/squirrel.windows
cd squirrel.windows
…NuGet\NuGet.exe restore
msbuild /p:Configuration=Release
- 参考官网教程:
打造你的第一个 Electron 应用
构建步骤(Windows)
autoUpdater
创建应用
- 新建文件夹znyts,里面新建几个文件
{
"name": "znyts",
"version": "1.0.0",
"main": "main.js",
"author": "lyt",
"description": "a demo create by lyt",
"scripts": {
"start": "electron ."
},
"devDependencies": {
"electron": "^4.1.0"
}
}
const {
app, BrowserWindow } = require('electron')
let win
function createWindow () {
win = new BrowserWindow({
width: 800, height: 600 })
win.loadFile('index.html')
win.webContents.openDevTools()
win.on('closed', () => {
win = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (win === null) {
createWindow()
}
})
//index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<style>
body,html{
margin:0;padding:0;
}
</style>
</head>