Javascript “电子”-webkit应用程序区域:拖动“;不';在浏览内容时不工作
在我的Electron应用程序中,我正在创建一个Javascript “电子”-webkit应用程序区域:拖动“;不';在浏览内容时不工作,javascript,electron,Javascript,Electron,在我的Electron应用程序中,我正在创建一个浏览器窗口: let window = new BrowserView({ title: "My App", frame: false, show: false } 然后我正在加载一个浏览视图: let view = new BrowserView(); window.setBrowserView(view); view.setBounds({ x: 0, y: 0, width: window.getContentBou
浏览器窗口
:
let window = new BrowserView({
title: "My App",
frame: false,
show: false
}
然后我正在加载一个浏览视图
:
let view = new BrowserView();
window.setBrowserView(view);
view.setBounds({ x: 0, y: 0, width: window.getContentBounds().width, height: window.getContentBounds().height });
view.setAutoResize({ width: true, height: true});
view.webContents.loadURL("MY URL HERE");
在加载到BrowserView
的内容中,我试图创建一个自定义标题栏,我做了如下操作:
<div id="windowBar">
<div id="draggableArea">
<div id="title"><span>My App</span></div>
<div id="controls">
<!-- The window controls to minimize/maximize/close the window here !-->
</div>
</div>
</div>
我无法从文件和我在网上找到的其他东西判断这是否有效。或者标题栏的HTML是否需要直接加载到浏览器窗口中才能正常工作
#windowBar {
height: 30px;
width: 100%;
position: fixed;
}
#draggableArea {
width: 100%;
height: 100%;
-webkit-app-region: drag;
}
#title {
-webkit-app-region: drag;
user-select: none;
}
#controls {
-webkit-app-region: no-drag;
}