自定义窗口
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.
📄️ Custom Title Bar
Application windows have a default chrome applied by the OS. Not to be confused with the Google Chrome browser, window _chrome_ refers to the parts of the window (e.g. title bar, toolbars, controls) that are not a part of the main web content. While the default title bar provided by the OS chrome is sufficent for simple use cases, many applications opt to remove it. Implementing a custom title bar can help your application feel more modern and consistent across platforms.
📄️ 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.
📄️ Custom Window Styles
!无边框窗口