设置右键菜单
作者:互联网
const {remote} = require('electron')
var rightTemplate = [
{
label:"粘贴" ,
accelerator:'ctrl+c', // 增加快捷键
},
{
label:"复制",
accelerator:'ctrl+v', // 增加快捷键
}
]
var m = remote.Menu.buildFromTemplate(rightTemplate) // 右键打开菜单 window.addEventListener('contextmenu',(e) => { e.preventDefault() m.popup({ window:remote.getCurrentWindow() }) })
var m = remote.Menu.buildFromTemplate(rightTemplate) // 右键打开菜单 window.addEventListener('contextmenu',(e) => { e.preventDefault() m.popup({ window:remote.getCurrentWindow() }) })
标签:rightTemplate,菜单,remote,accelerator,ctrl,快捷键,右键,设置 来源: https://www.cnblogs.com/eric-share/p/15856338.html