前言
因为要用到新版本的一些API,所以进行了electron版本的升级,项目基于electron-vue-template进行开发;
内容
安装最新长期维护版本的electron
npm install --save electron@15.3.0
我当时直接修改了package.json中版本的信息,执行了npm i electron的命令,哈哈哈哈
Browserslist: caniuse-lite is outdated
Browserslist: caniuse-lite is outdated. Please run: npx browserslist@latest --update-db
Could not detect abi for version 15.3.0 and runtime electron
Could not detect abi for version 15.3.0 and runtime electron. Updating "node-abi" might help solve this issue if it is a new release of electron npm install node-abi
process is not defined | module is not defined
mainWindow = new BrowserWindow({ ...... webPreferences: { nodeIntegration: true, contextIsolation: false, ..... } })
https://www.electronjs.org/zh/docs/latest/api/context-bridge#isolated-world
An object could not be cloned
渲染进程中的IPC封装有问题,按文档修改后即可
https://www.electronjs.org/zh/docs/latest/api/ipc-main#ipcmainonchannel-listener
学无止境,谦卑而行.