Skip to main content

类:TouchBarScrubber

类:TouchBarScrubber

🌐 Class: TouchBarScrubber

创建一个滚动选择器

进程: 主进程
此类未从 'electron' 模块导出。它仅作为 Electron API 中其他方法的返回值提供。

new TouchBarScrubber(options)

  • options 对象
    • items ScrubberItem[] - 要放入此清洁器的物品数组。
    • select Function(optional)- 当用户点击的项目不是最后一次点击的项目时调用。
      • selectedIndex Integer - 用户选择的项目索引。
    • highlight Function(optional)- 当用户点击任何项目时调用。
      • highlightedIndex Integer - 用户触碰的项目的索引。
    • selectedStyle string(optional)- 已选择的项目样式。可以是 backgroundoutlinenone。默认值为 none
    • overlayStyle string(optional)- 已选择的覆盖项目样式。可以是 backgroundoutlinenone。默认值为 none
    • showArrowButtons boolean(optional)- 是否显示箭头按钮。默认值为 false,且仅当 items 非空时显示。
    • mode string(optional)- 可以是 fixedfree。默认是 free
    • continuous boolean(optional)- 默认为 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]
  • outline - 映射到 [NSScrubberSelectionStyle outlineOverlayStyle]
  • none - 删除所有样式。

touchBarScrubber.overlayStyle

一个 string,表示应为擦除器中所选项目设置的样式。此样式会叠加在擦除器项目之上,而不是放在其后面。更新此值会立即更新触控栏中的控件。可能的值有:

🌐 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]
  • outline - 映射到 [NSScrubberSelectionStyle outlineOverlayStyle]
  • none - 删除所有样式。

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
  • free - 映射到 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.