var m = remote.Menu.buildFromTemplate(rightTemplate) // 右键打开菜单 window.addEventListener('contextmenu',(e) => { e.preventDefault() m.popup({ window:remote.getCurrentWindow() }) })
设置右键菜单
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() }) })