Back

electron - 针对不同版本的api (globalShortcut啥的)

发布时间: 2021-12-05 09:27:00

vue-electron 用的electron是  2.0.x ( https://github.com/electron/electron/blob/2-0-x/docs/api/global-shortcut.md ) ,  现在最新的版本是16.

所以,查看文档要明确版本号。

所以,对于老版本的globalShortcut:

https://github.com/electron/electron/blob/2-0-x/docs/api/global-shortcut.md

对应的vue-electron修改的文件是: src/main/index.js

import { app, BrowserWindow , globalShortcut} from 'electron'

  const ret = globalShortcut.register('F11', () => {
    mainWindow.webContents.openDevTools()
  })  

Back