index.js
/** * 消息对话框:显示简单的消息对话框 * titile 和 message * showMessageBox(options) * * 设置消息对话框的图标 * icon * * 设置消息对话框类型 * 1、默认对话框:none * 2、信息对话模型:info * 3、错误对话框:error * 4、询问对话框:question * 5、警告对话框:warning * * 设置消息对话框的按钮 * bttons * * 错误对话框 * showErrorBox() */ const {app,BrowserWindow} = require('electron'); function createWindow(){ win = new BrowserWindow({ //show:false, webPreferences:{ nodeIntegration: true, // 是否集成 Nodejs enableRemoteModule: true, contextIsolation: false, } }); win.loadFile('index.html'); win.on("ready-to-show",()=>{ win.show(); }); if(process.platform!="darwin"){ win.setIcon("images\\logn.jpg"); } win.on('closed',()=>{ console.log('closed') win=null; }); } app.on('ready',createWindow); app.on('window-all-closed',()=>{ console.log('window-all-closed'); if(process.platform!='darwin'){ } }); app.on('activate',()=>{ console.log('activate'); if(win==null){ createWindow(); } });