const { app, BrowserWindow } = require('electron');const path = require('path');function createWindow () {let mainWin = new BrowserWindow({x: 100,y: 100,show:false, // 默认不显示窗体width: 800,height: 800,maxHeight: 1000,maxWidth: 1000,minHeight: 400,minWidth: 400,// frame:false, // 只显示内容,隐藏默认菜单栏resizable: false, // 不允许缩放// transparent:true, // 透明窗体设置autoHideMenuBar:true, // 隐藏menu菜单icon: 'ty.ico',// icon: path.resolve(__dirname, 'ty.ico'),title:'ty 学习1' // 这里配置后,就要删掉页面的title配置,不然不生效})mainWin.loadFile('index.html'); // 这个要放到 ready-to-show 上面mainWin.on('ready-to-show', () => { // 监听事件,展示窗体mainWin.show();})mainWin.webContents.on('did-finish-load', () => {console.log('22-did-finish-load');})mainWin.webContents.on('dom-ready', () => {console.log('11-dom-ready');})mainWin.on('close', () => {console.log('33-window close');mainWin = null;})}app.on('ready', () => {createWindow();console.log('00-ready')});app.on('window-all-closed', () => {console.log('44-window-all-close');app.quit()})app.on('before-quit', () => {console.log('55-before-quit')})app.on('will-quit', () => {console.log('66-will-quit')})app.on('quit', () => {console.log('77-will-quit')})