electron 创建右键菜单

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());

        },
时间: 2024-08-06 15:36:33

electron 创建右键菜单的相关文章

[Google Map]创建右键菜单

CSS样式: .contextMenu { position: absolute; min-width: 100px; z-index: 1000; background: #fff; border-top: solid 1px #CCC; border-left: solid 1px #CCC; border-bottom: solid 1px #676767; border-right: solid 1px #676767; padding: 0px; margin: 0px; displa

[Baidu Map]创建右键菜单

关键代码: addMenu: function (menuItem) { /// <summary> /// 给地图添加右键菜单 /// eg: ///var menuItem = [ /// { /// text:'放大', /// callback:function(){window.bmap.zoomIn()} /// }, /// { /// text:'缩小', /// callback:function(){window.bmap.zoomOut()} /// } /// ]; /

Python3 tkinter基础 Menu Frame 创建右键菜单

? ???????Python : 3.7.0 ?????????OS : Ubuntu 18.04.1 LTS ????????IDE : PyCharm 2018.2.4 ??????Conda : 4.5.11 ???typesetting : Markdown ? example_1 code """ @Author : 行初心 @Date : 18-9-30 @Blog : www.cnblogs.com/xingchuxin @Gitee : gitee.com/

在ListCtrl上添加右键菜单,并创建响应函数。

一:添加右键菜单(在选中的行上面添加右键响应菜单) 1.首先创建一个菜单资源,在该项目上右键,添加资源,菜单资源,新建一个菜单资源(不会显示顶级菜单,只显示次级菜单). 2.在自己新添加的类CMyListCtrl(该类继承自CListCtrl,并且该类类型的对象与ListCtrl资源进行了绑定),并在该类的消息中添加=NM_RCLICK消息,在它的消息处理函数中, 添加右键弹出菜单代码: CMenu menu; menu.LoadMenuW(IDR_MENU1); //加载菜单资源 CMenu*

PyQt按钮右键菜单

本文原创,转载请注明原地址. 作者:酒醉东坡 原文地址:http://blog.csdn.net/jiuzuidongpo/article/details/46507403 实现效果如下图: 这篇文字主要写了两方面的内容: 第一是按钮的自定义,第二是右键菜单的使用,不仅是按钮的右键菜单,其他一些控件的右键菜单也可以类似创建和使用. 关于右键菜单则是QMenu的一些使用方法有: 样式表的使用: self.setStyleSheet("QMenu{background:purple;}"

为EasyUI 的Tab 标签添加右键菜单

在网上看了很多demo 自己实现了一个效果如下 ps jquery1.7.2 jQuery EasyUI 1.3.6easyui QQ群:15129679 <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>tabs 右键菜单demo QQ:15129

给jquery easy-ui 添加右键菜单

版权声明:转自为EasyUI 的Tab 标签添加右键菜单 1 <!doctype html> 2 <html> 3 <head> 4 <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 5 <title>tabs 右键菜单demo QQ:15129679</title> 6 <link rel="

EasyUI 的Tab 标签添加右键菜单

样式: 主要提供右键功能代码. (只需要提供你需要的js和css就行了) <!doctype html> <html> <head> <base href="/smile/" /> <title>标签右键菜单</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

【转载】Pyqt 添加右键菜单方法

转载地址: http://www.cnblogs.com/yogalau/p/3954042.html?utm_source=tuicool QListWidget 是继承 QWidget 的, 所以 QListWidget 是有右键菜单的, 从文档上可以找到 QWidget 上有以下两个与右键菜单有关的函数: Qt.ContextMenuPolicy contextMenuPolicy (self) setContextMenuPolicy (self, Qt.ContextMenuPolic