Skip to main content

Class: TouchBarSlider

Class: TouchBarSlider

Create a slider 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 TouchBarSlider(options)

  • options Object
    • label string (optional) - Label text.标签文本。
    • value Integer (optional) - Selected value.选定的值。
    • minValue Integer (optional) - Minimum value.最小值。
    • maxValue Integer (optional) - Maximum value.最大值。
    • change Function (optional) - Function to call when the slider is changed.当滑块更改时要调用的函数。
      • newValue number - The value that the user selected on the Slider.用户在“滑块”上选择的值。

Instance Properties实例属性

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

touchBarSlider.label

A string representing the slider's current text. 表示滑块当前文本的stringChanging this value immediately updates the slider in the touch bar.更改此值会立即更新触摸条中的滑块。

touchBarSlider.value

A number representing the slider's current value. 表示滑块当前值的numberChanging this value immediately updates the slider in the touch bar.更改此值会立即更新触摸条中的滑块。

touchBarSlider.minValue

A number representing the slider's current minimum value. 表示滑块当前最小值的numberChanging this value immediately updates the slider in the touch bar.更改此值会立即更新触摸条中的滑块。

touchBarSlider.maxValue

A number representing the slider's current maximum value. 表示滑块当前最大值的numberChanging this value immediately updates the slider in the touch bar.更改此值会立即更新触摸条中的滑块。