开发(Developing)
¥Developing
$ quasar dev -m electron
# ..or the longer form:
$ quasar dev --mode electron
# passing extra parameters and/or options to
# underlying "electron" executable:
$ quasar dev -m electron -- --no-sandbox --disable-setuid-sandbox
# when on Windows and using Powershell:
$ quasar dev -m electron '--' --no-sandbox --disable-setuid-sandbox
它会打开一个包含开发工具的 Electron 窗口。你拥有渲染器进程的 HMR,并且主进程的更改也会被应用(但后者会在每次更改时重新启动 Electron 窗口)。
¥It opens up an Electron window with dev-tools included. You have HMR for the renderer process and changes to main process are also picked up (but the latter restarts the Electron window on each change).
查看如何在 配置 Electron 页面上调整主进程和预加载脚本的 Esbuild 配置对象。
¥Check how you can tweak Esbuild config Object for the Main Process and the Preload script on the Configuring Electron page.
Chrome DevTools(Chrome DevTools)
在开发模式下,点击以下组合键(当你的应用窗口获得焦点时):
¥While in dev mode, hit the following combination (while your app window has focus):
macOS:Cmd Alt I 或 F12
¥macOS: Cmd Alt I or F12
Linux:Ctrl Shift I 或 F12
¥Linux: Ctrl Shift I or F12
Windows:Ctrl Shift I 或 F12
¥Windows: Ctrl Shift I or F12
Vuejs 开发者工具(Vuejs Devtools)
¥Vuejs Devtools
如果你还想访问渲染线程的 Vue Devtools:
¥Should you want to also access Vue Devtools for the renderer thread:
$ quasar dev -m electron --devtools
生产环境构建(Building for Production)
¥Building for Production
$ quasar build -m electron
# ..or the longer form:
$ quasar build --mode electron
它会构建你的应用以供生产环境使用,然后使用 @electron/packager 将其打包成可执行文件。查看如何在 配置 Electron 页面上进行配置。
¥It builds your app for production and then uses @electron/packager to pack it into an executable. Check how to configure this on Configuring Electron page.
如果你想要一个启用了调试功能的正式版 UI 代码:
¥If you want a production build with debugging enabled for the UI code:
$ quasar build -m electron -d
# ..or the longer form
$ quasar build -m electron --debug
非 Windows 用户须知(A note for non-Windows users)
¥A note for non-Windows users
如果你想在非 Windows 平台上使用自定义图标为 Windows 构建,则必须安装 wine。更多信息。
¥If you want to build for Windows with a custom icon using a non-Windows platform, you must have wine installed. More Info.
发布(仅限 Electron-Builder)(Publishing (electron-builder only))
¥Publishing (electron-builder only)
$ quasar build -m electron -P always
# ..or the longer form:
$ quasar build --mode electron --publish always
你可以指定使用 electron-builder
构建应用,可以直接在命令行(--bundler builder
)上进行,也可以在 quasar.config
文件中的 electron.bundler
处进行明确设置。使用 @electron/packager
时,此标志无效。
¥You can specify using electron-builder
to build your app either directly on the command line (--bundler builder
) or by setting it explicitly within the quasar.config
file at electron.bundler
. This flag has no effect when using @electron/packager
.
目前(2019 年 6 月)支持的发布目的地包括 GitHub、Bintray、S3、Digital Ocean Spaces 或通用 HTTPS 服务器。更多信息,包括如何创建有效的发布指令,可以在 此处 中找到。
¥Currently (June 2019) supported publishing destinations include GitHub, Bintray, S3, Digital Ocean Spaces, or a generic HTTPS server. More information, including how to create valid publishing instructions, can be found here.
-P
的有效选项为 “onTag”、“onTagOrDraft”、“always” 和 “never”,相关说明请参见上述链接。此外,你必须在 quasar.config
文件的 electron.builder
位置包含有效的 publish
配置指令。
¥Valid options for -P
are “onTag”, “onTagOrDraft”, “always” and “never” which are explained at the above link. In addition, you must have valid publish
configuration instructions in your quasar.config
file at electron.builder
.
将 Windows EXE 安装文件发布到 Amazon S3 的一个非常基本的配置可能如下所示:
¥A very basic configuration to publish a Windows EXE setup file to Amazon S3 might look like this:
electron: {
bundler: 'builder', // set here instead of using command line flag --bundler
builder: {
appId: 'com.electron.myelectronapp',
win: {
target: 'nsis'
},
publish: {
'provider': 's3',
'bucket': 'myS3bucket'
}
}