新消息提醒机制,调整为uni.$emit全局事件,网络状态变化亦然
This commit is contained in:
@@ -101,8 +101,19 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
if (this.isShown) {
|
||||
uni.$on('onReceiveMessage', (msg) => {
|
||||
console.log(msg);
|
||||
this.getConversationList()
|
||||
})
|
||||
uni.$on('onConnectionStatusChange', (status) => {
|
||||
this.connection = status
|
||||
})
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
if (this.$store.state.token !== '') {
|
||||
if (this.$store.state.token !== '') {
|
||||
this.getConversationList()
|
||||
}
|
||||
this.isShown = true
|
||||
@@ -125,16 +136,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$store.getters.newMessage': function(n, o) {
|
||||
if (this.isShown) {
|
||||
this.getConversationList()
|
||||
}
|
||||
},
|
||||
'$store.getters.connection': function(n, o) {
|
||||
this.connection = n
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
hidePop() {
|
||||
this.showPop = false
|
||||
|
||||
Reference in New Issue
Block a user