进程:
被用来让 BrowserWindow
嵌入更多的 web 内容。 它就像一个子窗口,除了它的位置是相对于父窗口。 这意味着可以替代webview
标签.
示例
参数
Object (可选)webPreferences
Object (可选) - 详情请看 BrowserWindow.
BrowserView.getAllViews()
BrowserView.fromWebContents(webContents)
BrowserView.fromId(id)
id
Integer返回BrowserView
- 带有的视图.
使用 new BrowserView
创建的对象具有以下属性:
view.webContents 实验功能
视图的 对象
view.id 实验功能
视图的唯一ID Integer
.
view.destroy()
强制关闭视图, 不会为网页发出 unload
和 beforeunload
事件。 完成视图后, 请调用此函数, 以便尽快释放内存和其他资源。
view.isDestroyed()
返回 Boolean
-判断窗口是否被销毁
view.setAutoResize(options) 实验功能
options
Objectwidth
Boolean - 如果为true
,视图宽度跟随窗口变化. 默认为false
.- Boolean - 如果为
true
,视图高度跟随窗口变化. 默认为false
. horizontal
Boolean - Iftrue
, the view's x position and width will grow and shrink proportionly with the window.false
by default.vertical
Boolean - Iftrue
, the view's y position and height will grow and shrink proportinaly with the window.false
by default.
view.setBounds(bounds) 实验功能
bounds
调整视图的大小,并将它移动到窗口边界
view.setBackgroundColor(color) 实验功能
color
String - 颜色值格式为#aarrggbb
或 , 透明度为可选参数.