feat: 新增组件
This commit is contained in:
26
controller/changeWindowSize.js
Normal file
26
controller/changeWindowSize.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const { ipcMain, BrowserWindow } = require("electron");
|
||||
|
||||
// 最小化
|
||||
ipcMain.on("window-min", (event) => {
|
||||
const webContent = event.sender;
|
||||
const win = BrowserWindow.fromWebContents(webContent);
|
||||
win.minimize();
|
||||
});
|
||||
|
||||
// 最大化
|
||||
ipcMain.on("window-max", (event) => {
|
||||
const webContent = event.sender;
|
||||
const win = BrowserWindow.fromWebContents(webContent);
|
||||
if (win.isMaximized()) {
|
||||
win.restore();
|
||||
} else {
|
||||
win.maximize();
|
||||
}
|
||||
});
|
||||
|
||||
// 关闭
|
||||
ipcMain.on("window-close", (event) => {
|
||||
const webContent = event.sender;
|
||||
const win = BrowserWindow.fromWebContents(webContent);
|
||||
win.close();
|
||||
});
|
||||
Reference in New Issue
Block a user