官方安裝
npm install -g vue-cli
vue init simulatedgreg/electron-vue my-project
cd my-project
yarn # or npm install
yarn run dev # or npm run dev
1,第一個問題 node-sass 能不用就不用
2, 注意vue 與 node版本
3,Object.fromEntries is not a function electron-vue報錯
yarn add polyfill-object.fromentries
.electron-vue/dev-client.js 中引入
import "polyfill-object.fromentries"
.electron-vue/dev-runner.js 檔案 取消註釋
app.use(hotMiddleware)
加入element-ui
yarn add element-ui
引入 element-ui
src/renderer/main.js
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
將element-ui加入白名單
.electron-vue/webpack.renderer.config.js
let whiteListedModules = ['vue','element-ui']
效果圖
Electron Security Warning (Node.js Integration with Remote Content)
main.js 中加入
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'
本作品採用《CC 協議》,轉載必須註明作者和本文連結