1.修改package.json
在main属性上面引入新的html页面
{
"main": "/index.html",
"name": "phadcloud",
"description": "名称",
"version": "1.0",
"keywords": ["名称"],
"window": {
"title": "名称",
"icon": "logo.png",
"toolbar": true,
"frame": true,
"position": "center",
"min_width": 600,
"min_height": 400,
"width": 1920,
"height": 1080,
"resizable": true
},
"webkit": {
"plugin": true
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
2.新建html页面
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script language="javascript" type="text/javascript">
window.location.href = 'https://跳转的地址';
var win = require('nw.gui').Window.get();
win.maximize();
win.show();
</script>
</body>
</html>
其他步骤
vue项目使用nw.js打包成桌面应用并修改图标 封装桌面应用_nw.js换图标-****博客