Skip to main content

Class: TouchBarPopover

Class: TouchBarPopover

Create a popover in the touch bar for native macOS applications在触摸条中为本机macOS应用程序创建弹出窗口

Process:进程:Main
This class is not exported from the 'electron' module. 此类不是从'electron'模块导出的。It is only available as a return value of other methods in the Electron API.它只能作为Electron API中其他方法的返回值使用。

new TouchBarPopover(options)

  • options Object
    • label string (optional) - Popover button text.弹出按钮文本。
    • icon NativeImage (optional) - Popover button icon.弹出按钮图标。
    • items TouchBar - Items to display in the popover.要在弹出窗口中显示的项目。
    • showCloseButton boolean (optional) - true to display a close button on the left of the popover, false to not show it. true表示在弹出窗口的左侧显示关闭按钮,false表示不显示。Default is true.默认值为true

Instance Properties

The following properties are available on instances of TouchBarPopover:TouchBarPopover实例上提供了以下属性:

touchBarPopover.label

A string representing the popover's current button text. 一个string,表示弹出窗口的当前按钮文本。Changing this value immediately updates the popover in the touch bar.更改此值会立即更新触摸栏中的弹出窗口。

touchBarPopover.icon

A NativeImage representing the popover's current button icon. 表示弹出窗口当前按钮图标的NativeImageChanging this value immediately updates the popover in the touch bar.更改此值会立即更新触摸栏中的弹出窗口。