electron菜单和右键菜单设置
background.ts
async function createWindow() {
// Create the browser window.
let win: BrowserWindow | null = new BrowserWindow({
// fullscreen: true // 全屏
// frame: false, // 让桌面应用没有边框,这样菜单栏也会消失
// resizable: false, // 不允许用户改变窗口大小
width: 800, // 设置窗口宽高
height: 600,
// icon: iconPath, //应用运行时的标题栏图标
minWidth: 300, // 最小宽度
minHeight: 500, // 最小高度
// maxWidth: 300, // 最大宽度
// maxHeight: 600, // 最大高度
// 进行对首选项的设置
webPreferences:{
backgroundThrottling: false, // 设置应用在后台正常运行
nodeIntegration:true, // 设置能在页面使用nodejs的API
contextIsolation: false, // 关闭警告信息
enableRemoteModule:true, // 开启remote模块
},
// autoHideMenuBar: true // 隐藏菜单栏
})