mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 03:01:12 +00:00
fix: 独立窗口不更新消息
This commit is contained in:
parent
9ae278d622
commit
629fe79c61
@ -799,11 +799,14 @@ export default {
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.subMsgListener()
|
||||
this.msgSubscribe = Store.subscribe('dialogMsgChange', this.onMsgChange);
|
||||
document.addEventListener('selectionchange', this.onSelectionchange);
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
this.subMsgListener(true)
|
||||
//
|
||||
this.$store.dispatch('forgetInDialog', this._uid)
|
||||
this.$store.dispatch('closeDialog', this.dialogId)
|
||||
//
|
||||
@ -1427,6 +1430,29 @@ export default {
|
||||
},
|
||||
|
||||
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
|
||||
|
||||
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}
|
||||
*/
|
||||
websocketMsgListener({state}, params) {
|
||||
if (typeof params === "string") {
|
||||
state.wsListener[params] && delete state.wsListener[params];
|
||||
return;
|
||||
}
|
||||
const {name, callback} = params;
|
||||
if (typeof callback === "function") {
|
||||
state.wsListener[name] = callback;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user