1、在渲染進程引用主進程模塊
var remote = require('electron').remote; var dialog = remote.dialog;
2、實現一點簡單的確定取消操作
dialog.showMessageBox({ type: "info",//圖標類型 title: "幫助",//信息提示框標題 message: "electron+vue實現菜單欄",//信息提示框內容 buttons: ["前往", "取消"],//下方顯示的按鈕 cancelId:2//點擊x號關閉返回值 }, function (index) { if(index==0){//點擊前往博客后,從本地瀏覽器打開博客地址 shell.openExternal('https://www.cnblogs.com/alex96/p/12031053.html') }
3、完成