1.yarn安装
yarn add -D electron
yarn add -D vue-cli-plugin-electron-builder
2.在main.js的同级目录中添加background.js
/** @format */
"use strict";
import {
app, protocol, BrowserWindow } from "electron";
// import {
// createProtocol,
// installVueDevtools,
// } from "vue-cli-plugin-electron-builder/lib";
const isDevelopment = process.env.NODE_ENV !== "production";
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win;
// Scheme must be registered before the app is ready
protocol.registerSchemesAsPrivileged([
{
scheme: "app",
privileges: {
secure: true,
standard: true
}
}
]);
function cre