类:TouchBarButton
类:TouchBarButton
为 macOS 原生应用程序在触摸栏中创建一个按钮
进程:主进程
此类未从 'electron' 模块导出。它仅作为 Electron API 中其他方法的返回值可用。
new TouchBarButton(options)
在定义 accessibilityLabel 时,请确保已考虑 macOS 最佳实践。
实例属性
TouchBarButton 实例可用的属性如下:
touchBarButton.accessibilityLabel
一个 string,表示屏幕阅读器将读取的按钮描述。仅当未设置标签时,屏幕阅读器才会读取此描述。
touchBarButton.label
一个 string,表示按钮的当前文本。更改此值会立即更新触摸栏中的按钮。
touchBarButton.backgroundColor
一个 string 十六进制代码,表示按钮的当前背景色。更改此值会立即更新触摸栏中的按钮。
touchBarButton.icon
一个 NativeImage,表示按钮的当前图标。更改此值会立即更新触摸栏中的按钮。
touchBarButton.iconPosition
一个 string - 可以是 left、right 或 overlay。默认为 overlay。
touchBarButton.enabled
一个 boolean,表示按钮是否处于启用状态。