在编写 Electron 应用程序时,macOS 构建提供了一个“关于”菜单项作为第一个菜单的第一项 1 .单击此按钮后,会弹出一个小面板,显示应用程序名称、版本和版权(如果有)2 .
如何自定义面板呈现的内容?
Electron menuItem role docs仅提及:
`about` - Map to the `orderFrontStandardAboutPanel` action.
apple docs on orderFrontStandardAboutPanel
不提供任何见解。
查看屏幕截图,包括自定义显示面板的示例(通过 GIMP):
最佳答案
这远没有您想要的那么漂亮,但是如果您只想为 macOS 自定义简单的内置关于面板,Electron 可以让您自定义文本。
您只需调用 app.setAboutPanelOptions
/*
Here's how the "About" dialog is displayed: (applies to macOS only)
<app icon>
<applicationName>
<applicationVersion> (<version>)
<credits>
<copyright>
*/
app.setAboutPanelOptions({
applicationName: "Name",
applicationVersion: "App Version",
version: "Version",
credits: "Credits",
copyright: "Copyright"
});
关于javascript - Electron 和 macOS : how to customize the 'About <app>' display panel that pops up when user clicks the 'About <app>' menuItem?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54170269/