Class: TouchBarButton
Class: TouchBarButton
Create a button 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 TouchBarButton(options)
When defining 在定义accessibilityLabel, ensure you have considered macOS best practices.accessibilityLabel时,请确保您考虑了macOS的最佳实践。
Instance Properties实例属性
The following properties are available on instances of TouchBarButton:TouchBarButton实例上提供了以下属性:
touchBarButton.accessibilityLabel
A 一个string representing the description of the button to be read by a screen reader. string,表示屏幕阅读器要读取的按钮的描述。Will only be read by screen readers if no label is set.只有在未设置标签的情况下,才会由屏幕阅读器读取。
touchBarButton.label
A 表示按钮当前文本的string representing the button's current text. string。Changing this value immediately updates the button in the touch bar.更改此值会立即更新触摸栏中的按钮。
touchBarButton.backgroundColor
A 一个string hex code representing the button's current background color. string表示按钮当前背景颜色的十六进制代码。Changing this value immediately updates the button in the touch bar.更改此值会立即更新触摸栏中的按钮。
touchBarButton.icon
A 表示按钮当前图标的NativeImage representing the button's current icon. NativeImage。Changing this value immediately updates the button in the touch bar.更改此值会立即更新触摸栏中的按钮。
touchBarButton.iconPosition
A 一个string - Can be left, right or overlay. string-可以是left、right或overlay。Defaults to 默认为overlay.overlay。
touchBarButton.enabled
A 一个boolean representing whether the button is in an enabled state.boolean,表示按钮是否处于启用状态。