window.location.href 切换窗口内容
function changePage (pageUrl) {
window.location.href = pageUrl
}
window.open 打开新的窗口
function windowOpen () {
// window.open 来创建一个新的窗口时候,将会创建一个 BrowserWindow 的实例,并且将返回一个标识,这个界面通过标识来对这个新的窗口进行有限的控制.
// window.open(url[, frameName][, features])
// url String
// frameName String (可选)
// features String (可选)
let url = path.join("file://",__dirname,"./pages/introduce.html");
let winObj = window.open(url)
}
new BrowserWindow 打开新的窗口
// 创建一个 BrowserWindow 对象,打开一个新的窗口
function openNewWindow() {
const modalPath = path.join("file://",__dirname,"./pages/introduce.html");
let win = new BrowserWindow({ width: 400, height: 275 });
win.on("resize", updateReply);
win.on("move", updateReply);
win.on("close", function() {
win = null;
});
win.loadURL(modalPath);
win.show();
function updateReply() {
const manageWindowBtn = document.getElementById("infoContainer");
const message = `Size: ${win.getSize()} Position: ${win.getPosition()}`;
manageWindowBtn.innerHTML = message;
}
}