当前位置: 首页 > news >正文

vue + electron

node 版本 v14.19.3
npm 版本 6.14.17
要是node-sass报错执行命令:

npm uninstall node-sass sass-loader
npm i node-sass@4.14.1 sass-loader@7.3.1 --save -dev

首先安装依赖

npm install electron
npm install electron-packager

electronRun.js放在根目录下

const { app, BrowserWindow } = require('electron')function createWindow() {// Create the browser window.const mainWindow = new BrowserWindow({width: 800,height: 600,webPreferences: {nodeIntegration: true}})mainWindow.loadURL('http://172.26.96.37:8011')//mainWindow.loadFile('dist/index.html')
}app.whenReady().then(() => {createWindow()app.on('activate', function() {if (BrowserWindow.getAllWindows().length === 0) createWindow()})
})app.on('window-all-closed', function() {if (process.platform !== 'darwin') app.quit()
})

根目录的vue.config.js
路由用mode:‘hash’

export default new Router({mode: 'hash', // https://router.vuejs.org/api/#modelinkActiveClass: 'open active',

把publicPath:‘./’,

package.json文件里面加package和main

{"name": "@coreui/coreui-free-vue-admin-template","version": "2.1.5","description": "Open Source Bootstrap Admin Template","author": "Łukasz Holeczek","main": "electronRun.js","homepage": "http://coreui.io","copyright": "Copyright 2018 creativeLabs Łukasz Holeczek","license": "MIT","repository": {"type": "git","url": "git@github.com:coreui/coreui-free-vue-admin-template.git"},"scripts": {"serve": "vue-cli-service serve","build": "vue-cli-service build","lint": "vue-cli-service lint","test:unit": "vue-cli-service test:unit","test:e2e": "vue-cli-service test:e2e","package": "electron-packager ./ package --platform=win32 --arch=x64 --out=./out --app-version=0.0.1 --overwrite --ignore=node_modules"},

打包程序npm run build 生成dist文件
然后在执行npm run package
看见项目有out文件夹,里面有个exe,执行(项目要运行起来,在执行exe)

http://www.lryc.cn/news/145591.html

相关文章:

  • spring中LocalDateTime 转成字符串的时候注意事项
  • vue数组对象中按某一字段排序
  • yolov5和yolov7部署的研究
  • 【JavaEE进阶】拦截器与统一功能处理
  • 2023年智慧政务一网通办云平台顶层设计与建设方案PPT
  • 安防监控/视频汇聚平台EasyCVR调用rtsp地址返回的IP不正确是什么原因?
  • 媒体服务器与视频服务器有什么区别
  • 菜鸟教程《Python 3 教程》笔记(11):循环语句
  • 【DevOps视频笔记】8. Jenkins 配置
  • C# 在Color[] colorTable中快速找到Color的索引位置
  • go学习笔记 炒土豆丝
  • FPGA VR摄像机-拍摄和拼接立体 360 度视频
  • vue集成mars3d后,basemaps加不上去
  • 油管视频直接生成PPT的AI工具!剖析c.ai和Pi的用户需求;独立创业者的操作指南;广告大佬的三个AI绘画实战 | ShowMeAI日报
  • WebSocket- 前端篇
  • 如何在 Python 中将图像转换为 PDF
  • 使用python编写脚本测试目标主机的TCP端口连通性
  • 华为云云服务器评测|基于华为云云耀云服务器L实例开展性能评测,例如 MySQL、Clickhouse、Elasticsearch等等
  • Git分布式版本控制系统与github
  • 基于Java+SpringBoot+Vue前后端分离中国陕西民俗网设计和实现
  • CSS3D+动画
  • list对象中如何根据对象中某个属性去重使用Java8流实现
  • 2023 在Windows上的安装Faiss-GPU(使用anaconda)
  • HTML及CSS入门及精通
  • frp实现二级代理
  • Vue组件设置背景色
  • Java+Github+Jenkins部署
  • vue使用命令npm install 报错 cb() never called!
  • 什么是LatexEasy及其在数学排版中的作用
  • axios 和fetch的取舍,以及比较