我在搜索应用程序在exe中编译时,正在搜索打开开发人员工具窗口的方法(使用<button>
),当我无法像在开发人员模式中那样使用快捷方式时。
答案 0 :(得分:2)
通过快捷键,您可以更好地使用按钮,而不是按钮。
使用 - https://www.npmjs.com/package/electron-localshortcut
该库提供了apis,可以在mac和windows上为您的电子应用程序注册本地快捷方式(而不是全局快捷方式)。
const electronLocalshortcut = require('electron-localshortcut');
function registerShortcuts() {
electronLocalshortcut.register(mainWindow, 'CommandOrControl+B', () => {
mainWindow.webContents.openDevTools();
});
}
app.on("ready", () => {
registerShortcuts();
});