×

Electron 教程

Electron 教程简介Electron 快速入门Electron 桌面环境集成Electron 在线/离线事件探测Electron 进程支持的 Chrome 命令行开关Electron 环境变量Electron 支持的平台Electron 应用部署Mac App Store 应用提交向导Electron 应用打包Electron 使用原生模块Electron 主进程调试使用 Selenium 和 WebDriverElectron DevTools扩展使用 Pepper Flash 插件使用 Widevine CDM 插件Electron 术语表Electron 离屏渲染Electron 交互式解释器 (REPL)Electron 自动更新功能autoUpdater

Electron API

Electron DOM File对象Electron DOM <webview>Electron window.open 函数

在主进程内可用的模块

Electron app 模块Electron autoUpdater 模块Electron BrowserWindow 模块Electron contentTracing 模块Electron dialog 模块Electron global-shortcut 模块Electron ipcMain 模块Electron menu 模块Electron MenuItem 模块Electron powerMonitor 模块Electron powerSaveBlockerElectron protocol 模块Electron session 模块Electron webContents 模块Electron Tray 模块Electron Locales

在渲染进程(网页)可用模块

Electron desktopCapturer模块Electron ipcRenderer 模块Electron remote 模块Electron webFrame 模块

两种进程都可用的模块

Electron clipboard 模块Electron crashReporter 模块Electron nativeImage 模块Electron screen 模块Electron shell 模块

Electron 开发

Electron 编码规范Electron 源码目录结构Electron 和 NW.js技术上的差异Electron 构建系统概览Electron 构建步骤 (OS X)Electron 构建步骤 (Windows)Electron 构建步骤 (Linux)调试中使用 Symbol ServerElectron 常见问题Electron 版本管理electron window 提交指南自动化持续集成系统(CI)测试Electron 文档风格指南

Electron MenuItem 模块


菜单项模块允许你向应用menu添加选项。

查看menu例子。

类:MenuItem

使用下面的方法创建一个新的 MenuItem

new MenuItem(options)

  • options Object
    • click Function - 当菜单项被点击的时候,使用 click(menuItem,browserWindow) 调用
    • role String - 定义菜单项的行为,在指定 click 属性时将会被忽略
    • type String - 取值 normalseparatorcheckboxorradio
    • label String
    • sublabel String
    • accelerator Accelerator
    • icon NativeImage
    • enabled Boolean
    • visible Boolean
    • checked Boolean
    • submenu Menu - 应当作为 submenu 菜单项的特定类型,当它作为 type: 'submenu' 菜单项的特定类型时可以忽略。如果它的值不是 Menu,将自动转为 Menu.buildFromTemplate
    • id String - 标志一个菜单的唯一性。如果被定义使用,它将被用作这个菜单项的参考位置属性。
    • position String - 定义给定的菜单的具体指定位置信息。

在创建菜单项时,如果有匹配的方法,建议指定 role 属性,不需要人为操作它的行为,这样菜单使用可以给用户最好的体验。

role属性值可以为:

  • undo
  • redo
  • cut
  • copy
  • paste
  • selectall
  • minimize - 最小化当前窗口
  • close - 关闭当前窗口

在 OS X 上,role 还可以有以下值:

  • about - 匹配 orderFrontStandardAboutPanel 行为
  • hide - 匹配 hide 行为
  • hideothers - 匹配 hideOtherApplications 行为
  • unhide - 匹配 unhideAllApplications 行为
  • front - 匹配 arrangeInFront 行为
  • window - "Window" 菜单项
  • help - "Help" 菜单项
  • services - "Services" 菜单项

分类导航

关注微信下载离线手册

bootwiki移动版 bootwiki
(群号:472910771)