Commit 07c00112 authored by 华国豪's avatar 华国豪 🙄

修复 重复粘贴图片bug

parent 49ef067a
......@@ -180,6 +180,7 @@ export default {
},
methods: {
atMsg(){
console.log(11111111111111)
this.MsgBus.$emit('send-at-name', this.atInfo.atName)
},
showCard(e){
......
......@@ -274,7 +274,7 @@ export default {
},
mounted() {
let user = this.$electron.remote.getGlobal("LOGINUSER");
this.ImAccount = this.user.ImAccount
this.ImAccount = user.ImAccount
//获取记录的操作区域高度
if (localStorage.consoleh && localStorage.consoleh != "") {
this.consoleinfo.currenth = parseInt(localStorage.consoleh);
......
......@@ -312,6 +312,7 @@ export default {
this.TOPSESSION = topSession;
},
enterChat(session) {
console.log(session)
if(session.id!=this.currentSession.id){
this.atIds=null
pageUtil.openDown=true
......
......@@ -81,9 +81,15 @@ export default {
deep: true
}
},
beforeDestroy() {
// 重复图片问题解决方案
// 事件处理中心msgBus,vue页面销毁后,原先的监听事件并没有销毁,导致组件再次载入的时候会重复相同的事件监听,所以当组件销毁时同时需要在 beforeDestroy 钩子中销毁对应的事件监听!!!
this.offMsgBusListener()
},
mounted() {
let that = this;
this.MsgBus.$on("send-at-name", function(name) {
console.log(name)
document.querySelector('#msgEditorBox').innerText = document.querySelector('#msgEditorBox').innerText + `@${name} `
})
this.MsgBus.$on("close-copy", function() {
......@@ -207,6 +213,10 @@ export default {
let myInterval = window.setInterval(this.updateClipboard, 500);
},
methods: {
offMsgBusListener(){
this.MsgBus.$off("send-at-name");
this.MsgBus.$off("new-screen-hot");
},
toolPaste: function (e) {
let clipboardData = 1;
document.getElementById('msgEditorBox').focus();
......@@ -391,17 +401,16 @@ export default {
position: absolute;
top: 0;
left: 0;
z-index: 5;
}
.tool-copy li{
z-index: 5;
padding: 10px;
font-size: 12px;
font-family: Microsoft YaHei;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 2px 5px 0px rgba(170, 170, 170, 0.75);
border: 1px solid rgb(170, 170, 170, 0.65);
cursor: pointer;
font-size: 14px;
padding: 5px 10px;
padding: 5px 20px;
list-style: none;
}
.tool-copy li:hover{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment