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

昆明网站建设服务建设银行朝阳支行网站

昆明网站建设服务,建设银行朝阳支行网站,大学生建设什么网站好,邯郸住房城乡建设厅网站Electron 打包工具有很多,如Electron-build、 Electron Forge 等,这里使用Electron-build,而Electron-build使用了nsis组件来创建安装向导,默认情况nsis安装向导不能自定义安装向导界面,但是nsis提供了nsis脚本可以扩展…

Electron 打包工具有很多,如Electron-build、 Electron Forge 等,这里使用Electron-build,而Electron-build使用了nsis组件来创建安装向导,默认情况nsis安装向导不能自定义安装向导界面,但是nsis提供了nsis脚本可以扩展安装向导。

0.效果图

在这里插入图片描述

1.配置nsis脚本

在新建nsis脚本文件resources/installer.nsh,并添加自定义内容:

!define MUI_LANGUAGE "Chinese"
Unicode true!include nsDialogs.nsh
!include LogicLib.nsh#OutFile nsDialogs.exe
#RequestExecutionLevel user
#ShowInstDetails showVar Dialog
Var apiUrl
Var other1
Var other2
Var other3
Var other4
Var skipSetPage custom pgPageCreate pgPageLeaveFunction pgPageCreatensDialogs::Create 1018Pop $Dialog${If} $Dialog == errorAbort${EndIf}${NSD_CreateGroupBox} 10% 10u 80% 100u "接入地址配置"Pop $0${NSD_CreateLabel} 20% 26u 20% 10u "接入地址:"Pop $0${NSD_CreateText} 40% 24u 40% 12u ""Pop $apiUrl${NSD_CreateLabel} 20% 40u 20% 10u "其他配置1:"Pop $0${NSD_CreateText} 40% 38u 40% 12u ""Pop $other1${NSD_CreateLabel} 20% 54u 20% 10u "其他配置2:"Pop $0${NSD_CreateText} 40% 52u 40% 12u ""Pop $other2${NSD_CreateLabel} 20% 68u 20% 10u "其他配置3:"Pop $0${NSD_CreateText} 40% 66u 40% 12u ""Pop $other3${NSD_CreateLabel} 20% 82u 20% 10u "其他配置4:"Pop $0${NSD_CreateText} 40% 80u 40% 12u ""Pop $other4${NSD_CreateCheckbox} 20% 96u 100% 10u "跳过当前设置"Pop $skipSetnsDialogs::Show
FunctionEndFunction PgPageLeave${NSD_GetText} $apiUrl $0${NSD_GetText} $other1 $1${NSD_GetText} $other2 $2${NSD_GetText} $other3 $3${NSD_GetText} $other4 $4${NSD_GetState} $skipSet $6;将配置信息写入文件: C:\用户\用户名\AppData\Roaming\demo\config.json${If} $6 == 0SetOutPath "$APPDATA\demo"CreateDirectory "$APPDATA\demo";FileOpen $9 $APPDATA\demo\config.json w;FileWrite $9 '{"apiUrl":"$0","other1":"$1","other2":"$2","other3":"$3","other4":"$4"}';FileClose $9;SetFileAttributes $APPDATA\demo\config.json NORMALStrCpy $0 '{"apiUrl":"$0","other1":"$1","other2":"$2","other3":"$3","other4":"$4"}'FileOpen $5 "$APPDATA\demo\config.json" "w"FileWrite $5 $0FileClose $5${EndIf}FunctionEndSection
SectionEnd

2.在package.json添加nsis脚本

在package.json的build中的nsis添加我们自定义nsis脚本的引用:"include": "resources/installer.nsh",完整配置如下:

"build": {"appId": "com.demo.electron","productName": "Electron应用示例","copyright": "Copyright © Electron应用示例","mac": {"category": "public.app-category.utilities"},"win": {"icon": "./resources/icons/icon.ico","target": [{"target": "nsis","arch": ["ia32","x64"]}],"artifactName": "${productName}_${version}-${arch}.${ext}"},"nsis": {"oneClick": false,"allowElevation": true,"allowToChangeInstallationDirectory": true,"installerIcon": "./resources/icons/icon.ico","uninstallerIcon": "./resources/icons/icon.ico","installerHeaderIcon": "./resources/icons/icon.ico","createDesktopShortcut": true,"createStartMenuShortcut": true,"shortcutName": "Electron应用示例","runAfterFinish": true,"include": "resources/installer.nsh"},"files": ["dist/**/*","dist-electron/**/*"],"directories": {"buildResources": "assets","output": "dist-build"},"publish": [{"provider": "generic","url": "http://192.168.1.2/release/"}],"extraResources": ["./plugins/${platform}/${arch}/**"]},

3.打包

执行打包命令:
npm run electron:build.exe

打包完双击安装包就有效果了。

http://www.yayakq.cn/news/22596/

相关文章:

  • 汽车网站页面布局设计山西网站建设营销什么价格
  • 婚庆手机版网站建设wordpress get_the_id
  • 做漂亮的网站如何做别人网站镜像
  • 大型网站建设济南兴田德润o团队怎么样十大少儿编程教育品牌
  • 网站公司企业网站北京建站公司哪个好
  • 支付网站建设费账务处理代理好项目
  • 企业官网建站流程济宁官方网站
  • 自己做的网站怎么爬数据库贵州企业网站开发公司
  • 番禺制作网站平台深圳网站建设运营公司
  • 做企业网站那家好wordpress4.4.2下载
  • 怎么联系网站开发团队ppt大全免费模板
  • 2015个人网站如何去工信部备案福田蒙派克二手车
  • 网站设置访问权限小程序做一个要多少钱
  • 罗湖住房和建设局网站开公司核名的网址
  • 夺宝网站还可以做吗有哪些网站建设公司
  • 自己建网站卖东西好卖吗17858833595做网站
  • 自己做网站新手入门建设工程合同包括三种
  • 深圳珠宝网站设计惠州注册公司流程和费用
  • 收费网站解决方案上传网站主办者承诺书
  • 国内网站排名wordpress分类目录关键字
  • 做外贸女装有哪些网站有哪些河南网站seo
  • 快速网站建设服务烟台建设用地规划查询网站
  • 青海网站建设怎么建设网站设计语言
  • wordpress建站位置关键词优化排名费用
  • 学校门户网站群建设方案杂志排版设计用什么软件
  • 一个人做网站如何让网站快速收录
  • 外贸网站找人建设wordpress默认页面设置
  • 国内网站有哪些网站怎么做下载网页代码
  • 网站建设是广告吗什么专业就业前景好
  • 提供镇江网站建设新乡网站建设公司