文章来源:http://www.imtr.cn/html/n271.html
在/resources/app/lib/main.js中搜索const contextMenu = electron_1.Menu.buildFromTemplate,在这个代码的上一句中新增BrowserWindow刷新模块:
const { Menu, clipboard, shell, BrowserWindow } = require('electron');
然后在这个方法里新增代码:
{ label: '刷新页面', click: () => {// 刷新当前窗口的页面 const currentWindow = BrowserWindow.getFocusedWindow(); if (currentWindow) { const webContents = currentWindow.webContents; webContents.reload(); } }, },
这样就可以在应用程序图标上单击右键,刷新当前页面
原文地址:http://www.imtr.cn/html/n271.html