newWinpage = new BrowserWindow({
width: 450,
height: 660,
minWidth: 450,
minHeight: 660,
frame: false,
webPreferences: {
nodeIntegration: true,
webviewTag: true
}
});
newWinpage.loadURL("https:www.baidu.com")
const view = new BrowserView()
newWinpage.setBrowserView(view) //将子窗口view嵌入到父窗口newWinpage中
view.setBounds({ x: 0, y: 52, width: 450, height: 660 })
view.webContents.loadURL(data.customerUrl + "?ticket=" + data.ticket + "&channelNo=YHXXKF")
view.setAutoResize({ width: true, height: true }) //视图的宽度与窗口一起增长和缩小
newWinpage.on("closed", () => {
newWinpage = null;
});
BrowserView嵌套子窗口
最新推荐文章于 2024-03-05 00:00:00 发布