dialog.js
//对话框
//提示输入.
//引入模块
const { dialog,nativeImage } = require('electron');
const path = require('path');
console.log(path.join(__dirname,'./../static/imgs/2.jpg'));
//显示对话框
dialog.showMessageBox({
type:'info',
title: '温馨提示',
icon:nativeImage.createFromPath(path.join(__dirname,'./../static/imgs/2.jpg')),
message: '今晚有女神约去吗',
buttons: ['必须', '丑拒']
}, function (index) {
//必须
//丑拒
if (index == 0) {
console.log("0");
} else if (index == 1) {
console.log("1");
}
});
//显示错误对话框
// dialog.showErrorBox('坏消息','女神已经有约了,不来了');
main.js
//引入dialog
require('./main-process/dialog')