electron实现MessageBox

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、完成

4、electron入门级学习资料免费获取

posted @ 2019-12-17 17:07  (至尊宝)  阅读(1067)  评论(0编辑  收藏  举报