This repository has been archived on 2025-01-09. You can view files and clone it, but cannot push or open issues or pull requests.
2025-01-09 18:30:49 +08:00

24 lines
651 B
JavaScript

const { remote } = require('electron')
window.addEventListener('DOMContentLoaded', () => {
// 利用 remote 获取当前窗口对象
let mainWin = remote.getCurrentWindow()
// 获取元素添加点击操作的监听
let aBtns = document.getElementsByClassName('function')
aBtns[0].addEventListener('click', () => {
// 最小化
mainWin.minimize()
})
aBtns[1].addEventListener('click', () => {
// 最大化
mainWin.isMaximized() ? mainWin.restore() : mainWin.maximize()
})
aBtns[2].addEventListener('click', () => {
// 关闭窗口操作
mainWin.close()
})
})