类: TouchBarButton

    Process: Main
    此类不从 'electron' 模块导出. 它只能作为Electron API中其他方法的返回值。

    • 选项 对象
      • labelString (可选) 按钮文本。
      • backgroundColorString (可选) - 按钮背景颜色以十六进制格式,例如 。
      • icon | String (optional) - Button icon.
      • iconPositionString (可选) - 可以是 leftrightoverlay。 默认值为 overlay
      • clickfunction (可选) - 单击按钮时调用的函数。
      • enabled Boolean (optional) - Whether the button is in an enabled state. 默认值为 true

    When defining accessibilityLabel, ensure you have considered macOS best practices.

    实例属性

    touchBarButton.accessibilityLabel

    A representing the description of the button to be read by a screen reader. Will only be read by screen readers if no label is set.

    touchBarButton.label

    A String representing the button’s current text. Changing this value immediately updates the button in the touch bar.

    touchBarButton.backgroundColor

    touchBarButton.icon

    A NativeImage representing the button’s current icon. Changing this value immediately updates the button in the touch bar.

    touchBarButton.iconPosition

    A String - Can be left, right or overlay. 默认值为 overlay