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