默认都不开启dev tools。 开启调试方式: 先选中你要 Debug 的视图 快速点击三下键盘左侧的 control 按键 相关代码 export function startDevToolsIfNeed(webContents: WebContents) { if (!app.isPackaged || ServiceManager.shared.backendEnvService.env !== 'prod') { let clicks = 0; let previousClickTime =...
Devtools don't open when project located in network mapped folder on Windows (6.0.0)#19589 Closed 3 tasks This is more than just an annoyance since my electron app needs to run elevated in order to function properly - now I just can't use dev tools. So the "workaround" of using a ...
窗口实例有一个可选的 openDevTools() 方法,可以在当前窗口中打开一个 Chrome Dev Tools 的实例,用作调试。 接着,我们应该稍微组织一下我们的代码。我推荐在 src/ 文件夹中创建一个 windows/ 文件夹,在这个文件夹中,我们可以为每个窗口创建一个子文件夹,比如: my-app |- src/ |-- windows/ |--- main/...
env.WEBPACK_DEV_SERVER_URL); if (!process.env.IS_TEST) win.webContents.openDevTools(); } else { createProtocol('app'); win.loadURL('http://localhost:8080'); } win.on('closed', () => { win = null; }); } app.on('window-all-closed', () => { if (process.platform !== ...
const {app, BrowserWindow} = require('electron'); // 保持对window对象的全局引用,如果不这么做的话,当JavaScript对象被 // 垃圾回收的时候,window对象将会自动的关闭 let win; /** * */ function createWindow() { // 创建浏览器窗口。 win = new BrowserWindow({ ...
Especially, if working on Windows, open PowerShellas Administrator, and runnpm install --global --production windows-build-toolsto install a separated Python 2.7 in%USERPROFILE%\.windows-build-tools\python27and other required VS libraries. We only need to do it at once. ...
process.env.ELECTRON_NODE_INTEGRATION}})if(process.env.WEBPACK_DEV_SERVER_URL){// Load the url of the dev server if in development modeawaitwin.loadURL(process.env.WEBPACK_DEV_SERVER_URL)// if (!process.env.IS_TEST) win.webContents.openDevTools()}else{createProtocol('app')// Load the...
app.on('activate', function() { // On macOS it's common to re-create a window in the app when the // dock icon is clicked and there are no other windows open. if (BrowserWindow.getAllWindows().length === 0) createWindow() ...
写UI 及其简单方便好看
mkdir my-electron-app && cd my-electron-app npm init -y npm install -g electron 1. 2. 3. 4. 5. 创建主进程脚本文件main.js 主脚本指定了运行主进程的 Electron 应用程序的入口(就我们而言,是 main.js 文件)。 通常,在主进程中运行的脚本控制应用程序的生命周期、显示图形用户界面及其元素、执行本...