自定义窗口
BrowserWindow
模块是您的Electron应用程序的基础,并且它暴露了需要可以改变您浏览器窗口的外观和行为的API。 本节介绍如何在macOS、 Windows和Linux上实现窗口定制的各种使用案例。
BrowserWindow
is a subclass of the BaseWindow
module. Both modules allow you to create and manage application windows in Electron, with the main difference being that BrowserWindow
supports a single, full size web view while BaseWindow
supports composing many web views. BaseWindow
can be used interchangeably with BrowserWindow
in the examples of the documents in this section.
📄️ 自定义标题栏
应用窗口有OS设置的默认窗口外框(chrome)。 不要与Google Chrome浏览器混淆, _窗口外框(chrome)_ 是指窗口中不是主网页内容的部分(如标题栏,工具栏,控件)。 虽然OS的窗口外框提供的默认标题栏对于简单用例足够了,但是很多应用选择去除它。 实现一个自定义的标题栏可以使您的应用更有现代感,并在多个平台中保持一致。
📄️ Custom Window Interactions
By default, windows are dragged using the title bar provided by the OS chrome. Apps that remove the default title bar need to use the app-region CSS property to define specific areas that can be used to drag the window. Setting app-region: drag marks a rectagular area as draggable.
📄️ 自定义窗口样式
!无边框窗口