本文作者原创,首发在本博客;CSDN 上的同名文章已标注为转载并回链到本页:https://blog.csdn.net/qq_30220519/article/details/139549350
模块安装打包
npm install -g electron-forge
electron-forge init my-project –template=vue
npm start //进入目录启动
//打包成一个目录到out目录下,注意这种打包一般用于调试,并不是用于分发
npm run package
//打出真正的分发包,放在out\make目录下
npm run makenpx @electron-forge/cli@latest import
npx create-electron-app my-appnpm install mousetrap //快捷键绑定库
npm install worker_threads //工作线程模块
npm install worker-loader //
npm init //C++项目目录下初始化项目
npm install –global –production windows-build-tools
electron 将pc端(vue)页面打包为桌面端应用-CSDN博客
快速体验
npm install -g electron-prebuilt
git clone https://github.com/electron/electron-quick-start
cd electron-quick-start
npm install && npm startcnpm install electron-packager -g
“scripts”: {“package”:”electron-packager . HelloWorld –platform=win32 –arch=x64 –icon=computer.ico –out=./out –asar –app-version=0.0.1 –overwrite –ignore=node_modules”
}
npm run package
GitHub - electron/electron-api-demos: Explore the Electron APIs
@python “%~dp0gyp_main.py” %*
JS调用C++
1 |
|
V8_EXPORT
V8_INLINE
v8::Handle<
v8::Local<
const v8::Arguments
const v8::FunctionCallbackInfov8::Value& 不定参数
Localtpl = FunctionTemplate::New(isolate);
G
String::NewFromUtf8Literal(isolate, “isNull”)
String::Cast
isolate->GetCurrentContext()
NODE_SET_PROTOTYPE_METHOD(tpl, “x”, X);
https://github.com/alibaba/jsni.git
nodeqt
1 | const qt = require("./lib/qt"); |
GitHub - arturadib/node-qt: C++ Qt bindings for Node.js
GitHub - NickCis/nodeQt: Qt binding for Node
GitHub - a7ul/mdview-nodegui: A Markdown editor in NodeGui
GitHub - kusti8/node-qt-napi: Node.js bindinds for Qt5, using NAPI
GitHub - nodegui/qode: DEPRECATED: Please see https://github.com/nodegui/qodejs instead
GitHub - svalaskevicius/qtjs-generator: Qt API bindings generator for Node.js
GitHub - nodegui/nodegui-starter: A starter repo for NodeGui projects
GitHub - anak10thn/qhttpserver: HTTP server implementation for Qt based on node.js’ http parser
GitHub - anak10thn/chrome-app-samples: Chrome Apps
GitHub - magne4000/node-qtdatastream: Nodejs lib which can read/write Qt formatted Datastreams
GitHub - fwestrom/qtort-microservices: A simple micro-services framework for Node.js.
GitHub - ivan770/PiQture: Screenshot tool based on Electron
GitHub - miskun/qtc-sdk-node: Qt Cloud Services SDK for Node.js
v8: include/v8.h File Reference
nodegyp
node-gyp -j 8 configure
node-gyp -j 8 build
“install”: “node-gyp -j 8 rebuild –arch=ia32”
“install”: “node-gyp -j 8 rebuild –arch=x86”
https://github.com/kusti8/node-qt-napi/releases/download/0.0.4/qt-v0.0.4-4-win32-x64.tar.gz
TortoiseGit bash使用
1 | set PRJ_PATH=E:\workspace\test\Web-Dev-For-Beginners\nodeqt |
git bash使用
1 | git config --global user.name "your-name" |
参考
[GitHub - electron/electron-api-demos: Explore the Electron APIsExplore the Electron APIs. Contribute to electron/electron-api-demos development by creating an account on GitHub.

https://github.com/electron/electron-api-demos](https://github.com/electron/electron-api-demos “GitHub - electron/electron-api-demos: Explore the Electron APIs”)[Quick Start | ElectronThis guide will step you through the process of creating a barebones Hello World app in Electron, similar to electron/electron-quick-start.

https://electronjs.org/docs/tutorial/quick-start](https://electronjs.org/docs/tutorial/quick-start “Quick Start | Electron”)[https://github.com/electron/electron-quick-start

https://github.com/electron/electron-quick-start](https://github.com/electron/electron-quick-start “https://github.com/electron/electron-quick-start“) GitHub - qtoolkit/qtk: QTK 是一套基于HTML5 Canvas实现的, 专注于桌面/移动应用程序开发的框架。
https://github.com/sindresorhus/awesome-electron
GitHub - atom/atom: :atom: The hackable text editor
GitHub - nodejs/node-addon-api: Module for using Node-API from C++
创作不易,小小的支持一下吧!

