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

38 lines
927 B
JavaScript

const { app, BrowserWindow } = require('electron')
function createWindow() {
let mainWin = new BrowserWindow({
width: 800,
height: 600,
show: false,
title: "标题", // 要在网页里的标题去除
icon: "w.png", // 设置图标
frame: true, // 是否显示标题栏
transparent: false, // 透明窗体
autoHideMenuBar: true, // 隐藏菜单
webPreferences: {
nodeIntegration: true, // Node集成环境
enableRemoteModule: true, // 开启远程模块 remote
}
})
// 防止首页白屏,否则不显示
mainWin.on('ready-to-show', () => {
mainWin.show()
})
mainWin.loadFile('index.html')
mainWin.on('close', () => {
mainWin = null // 删除引用,释放空间
})
}
app.on('ready', () => {
createWindow()
})
app.on('window-all-closed', () => {
app.quit()
})