1.安装模块
npm install electron-updater --save
2.修改package.json,加入以下代码
"publish": [
{
"provider": "generic",
"url": "http://127.0.0.1:8080"
}
],
3.核心文件
import { app, BrowserWindow, Menu, ipcMain } from 'electron'
import '../renderer/store'
import { autoUpdater } from 'electron-updater'
const { initDownload } = require('../../utils/download')
const path = require('path')
/**
* Set `__static` path to static files in production
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
*/
if (process.env.NODE_ENV !== 'development') {
global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
}
let mainWindow
const winURL = process.env.NODE_ENV === 'development'
? `http://localhost:9080`
: `file://${__dirname}/index.html`
function createWindow () {
Menu.setApplicationMenu(null)
/**
* Initial window options
*/
mainWindow = new BrowserWindow({
h