mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 11:07:06 +00:00
fix: 独立窗口不更新消息
This commit is contained in:
parent
9ae278d622
commit
629fe79c61
@ -799,11 +799,14 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.subMsgListener()
|
||||||
this.msgSubscribe = Store.subscribe('dialogMsgChange', this.onMsgChange);
|
this.msgSubscribe = Store.subscribe('dialogMsgChange', this.onMsgChange);
|
||||||
document.addEventListener('selectionchange', this.onSelectionchange);
|
document.addEventListener('selectionchange', this.onSelectionchange);
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
this.subMsgListener(true)
|
||||||
|
//
|
||||||
this.$store.dispatch('forgetInDialog', this._uid)
|
this.$store.dispatch('forgetInDialog', this._uid)
|
||||||
this.$store.dispatch('closeDialog', this.dialogId)
|
this.$store.dispatch('closeDialog', this.dialogId)
|
||||||
//
|
//
|
||||||
@ -1427,6 +1430,29 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
/**
|
||||||
|
* 订阅消息(用于独立窗口)
|
||||||
|
* @param unsubscribe
|
||||||
|
*/
|
||||||
|
subMsgListener(unsubscribe = false) {
|
||||||
|
if (!$A.isSubElectron) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (unsubscribe) {
|
||||||
|
this.$store.dispatch('websocketMsgListener', 'DialogWrapper')
|
||||||
|
} else {
|
||||||
|
this.$store.dispatch('websocketMsgListener', {
|
||||||
|
name: 'DialogWrapper',
|
||||||
|
callback: (msgDetail) => {
|
||||||
|
const {type, mode, data} = msgDetail;
|
||||||
|
if (type === 'dialog' && mode === 'add') {
|
||||||
|
this.tempMsgs.push(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送消息
|
* 发送消息
|
||||||
* @param text
|
* @param text
|
||||||
|
|||||||
4
resources/assets/js/store/actions.js
vendored
4
resources/assets/js/store/actions.js
vendored
@ -3878,6 +3878,10 @@ export default {
|
|||||||
* @param params {name, callback}
|
* @param params {name, callback}
|
||||||
*/
|
*/
|
||||||
websocketMsgListener({state}, params) {
|
websocketMsgListener({state}, params) {
|
||||||
|
if (typeof params === "string") {
|
||||||
|
state.wsListener[params] && delete state.wsListener[params];
|
||||||
|
return;
|
||||||
|
}
|
||||||
const {name, callback} = params;
|
const {name, callback} = params;
|
||||||
if (typeof callback === "function") {
|
if (typeof callback === "function") {
|
||||||
state.wsListener[name] = callback;
|
state.wsListener[name] = callback;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user