码迷,mamicode.com
首页 > 其他好文 > 详细

electron 创建右键菜单

时间:2017-09-15 23:43:22      阅读:361      评论:0      收藏:0      [点我收藏+]

标签:null   func   pup   ssh   app   logs   als   nbsp   nms   

1、引入模块
    const Electron = require(‘electron‘);
    const remote = Electron.remote;
    const Menu = remote.Menu;
    const MenuItem = remote.MenuItem;

2、 
  data() {
        return {
            isShowMember:false,
            menu:null,
        }
    },


 created() {
        this.targetId = this.id;
        notificationCenter.on("onClosePop", this.onClosePop);
        this.initMenu();
   },

3、methods: {
        //初始化右键菜单
        initMenu(){
            this.menu = new Menu();
            let that = this;
            this.menu.append(new MenuItem({ label: ‘删除‘, click: function() {
                //删除本地文件.
                that.imServices.deleteLocationMsgFiles(that.rightMessage);
                //删除消息
                that.imServices.removeMessages(that.rightMessage.peer, that.rightMessage.msgID);
                that.rightMenuMsg(that.rightMessage);
            } }));
        },


  rightShow(item) {
            this.rightMessage = item;
            this.menu.popup(remote.getCurrentWindow());

        },

 

electron 创建右键菜单

标签:null   func   pup   ssh   app   logs   als   nbsp   nms   

原文地址:http://www.cnblogs.com/sxz2008/p/7529055.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!