Skip to main content

类:TouchBarScrubber

类:TouchBarScrubber

¥Class: TouchBarScrubber

创建一个洗涤器(可滚动选择器)

¥Create a scrubber (a scrollable selector)

进程:主进程
该类不是从 'electron' 模块导出的。它仅可用作 Electron API 中其他方法的返回值。

¥Process: Main
This class is not exported from the 'electron' module. It is only available as a return value of other methods in the Electron API.

new TouchBarScrubber(options)

  • options 对象

    ¥options Object

    • items ScrubberItem[] - 要放置在该洗涤器中的一系列物品。

      ¥items ScrubberItem[] - An array of items to place in this scrubber.

    • select 功能(可选) - 当用户点击不是上次点击的项目时调用。

      ¥select Function (optional) - Called when the user taps an item that was not the last tapped item.

      • selectedIndex 整数 - 用户选择的项目的索引。

        ¥selectedIndex Integer - The index of the item the user selected.

    • highlight 功能(可选) - 当用户点击任何项目时调用。

      ¥highlight Function (optional) - Called when the user taps any item.

      • highlightedIndex 整数 - 用户触摸的项目的索引。

        ¥highlightedIndex Integer - The index of the item the user touched.

    • selectedStyle 字符串(可选) - 所选项目样式。可以是 backgroundoutlinenone。默认为 none

      ¥selectedStyle string (optional) - Selected item style. Can be background, outline or none. Defaults to none.

    • overlayStyle 字符串(可选) - 选定的叠加项目样式。可以是 backgroundoutlinenone。默认为 none

      ¥overlayStyle string (optional) - Selected overlay item style. Can be background, outline or none. Defaults to none.

    • showArrowButtons 布尔值(可选) - 是否显示箭头按钮。默认为 false,仅当 items 非空时才显示。

      ¥showArrowButtons boolean (optional) - Whether to show arrow buttons. Defaults to false and is only shown if items is non-empty.

    • mode 字符串(可选) - 可以是 fixedfree。默认为 free

      ¥mode string (optional) - Can be fixed or free. The default is free.

    • continuous 布尔值(可选) - 默认为 true

      ¥continuous boolean (optional) - Defaults to true.

实例属性

¥Instance Properties

以下属性在 TouchBarScrubber 的实例上可用:

¥The following properties are available on instances of TouchBarScrubber:

touchBarScrubber.items

代表此清理器中的项目的 ScrubberItem[] 数组。更新此值会立即更新触摸栏中的控件。更新此数组内的深层属性不会更新触摸栏。

¥A ScrubberItem[] array representing the items in this scrubber. Updating this value immediately updates the control in the touch bar. Updating deep properties inside this array does not update the touch bar.

touchBarScrubber.selectedStyle

string 代表洗涤器中所选项目应具有的样式。更新此值会立即更新触摸栏中的控件。可能的值:

¥A string representing the style that selected items in the scrubber should have. Updating this value immediately updates the control in the touch bar. Possible values:

  • background - 映射到 [NSScrubberSelectionStyle roundedBackgroundStyle]

    ¥background - Maps to [NSScrubberSelectionStyle roundedBackgroundStyle].

  • outline - 映射到 [NSScrubberSelectionStyle outlineOverlayStyle]

    ¥outline - Maps to [NSScrubberSelectionStyle outlineOverlayStyle].

  • none - 删除所有样式。

    ¥none - Removes all styles.

touchBarScrubber.overlayStyle

string 代表洗涤器中所选项目应具有的样式。此样式覆盖在 Scrubber 项的顶部,而不是放在其后面。更新此值会立即更新触摸栏中的控件。可能的值:

¥A string representing the style that selected items in the scrubber should have. This style is overlaid on top of the scrubber item instead of being placed behind it. Updating this value immediately updates the control in the touch bar. Possible values:

  • background - 映射到 [NSScrubberSelectionStyle roundedBackgroundStyle]

    ¥background - Maps to [NSScrubberSelectionStyle roundedBackgroundStyle].

  • outline - 映射到 [NSScrubberSelectionStyle outlineOverlayStyle]

    ¥outline - Maps to [NSScrubberSelectionStyle outlineOverlayStyle].

  • none - 删除所有样式。

    ¥none - Removes all styles.

touchBarScrubber.showArrowButtons

boolean 代表是否在此洗涤器中显示左/右选择箭头。更新此值会立即更新触摸栏中的控件。

¥A boolean representing whether to show the left / right selection arrows in this scrubber. Updating this value immediately updates the control in the touch bar.

touchBarScrubber.mode

string 代表该洗涤器的模式。更新此值会立即更新触摸栏中的控件。可能的值:

¥A string representing the mode of this scrubber. Updating this value immediately updates the control in the touch bar. Possible values:

  • fixed - 映射到 NSScrubberModeFixed

    ¥fixed - Maps to NSScrubberModeFixed.

  • free - 映射到 NSScrubberModeFree

    ¥free - Maps to NSScrubberModeFree.

touchBarScrubber.continuous

boolean 代表该洗涤器是否连续。更新此值会立即更新触摸栏中的控件。

¥A boolean representing whether this scrubber is continuous or not. Updating this value immediately updates the control in the touch bar.