赞
踩
1、首先使用 npm run build 打包为dist文件;
2、新建一个deskapp文件夹,里面在新建一个App文件夹,把打包好的dist里面的所有文件拷贝到App文件夹里面;
3、在deskapp文件夹中新建一个package.json文件,拷贝下面的内容:
{ "name": "deskapp", "version": "1.0.0", "description": "", "main": "App/index.html", "window": { "title": "我的桌面应用", "icon": "", "width": 1366, "height": 768, "toolbar": false, "frame": true, "resizable": true, "position": "center", "transparent": false, "show": true }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dist": "build --tasks win-x86,win-x64 --mirror https://npm.taobao.org/mirrors/nwjs/ .", "start": "run --x86 --mirror https://npm.taobao.org/mirrors/nwjs/ ." }, "author": "", "license": "ISC", "devDependencies": { "nwjs-builder-phoenix": "^1.15.0" }, "build": { "nwVersion": "0.27.5" } }
4、然后在deskapp文件下打开cmd,npm install安装依赖包;
5、执行正式打包桌面应用的命令: npm run dist,会得到一个dist文件;
6、进入dist文件夹有两个文件,其中x64就是打包好的桌面应用,双击进入会看到exe文件:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。