消息列表刷新

This commit is contained in:
2022-02-07 17:46:07 +08:00
parent f7495257fa
commit 0bfdcdf6af
2 changed files with 7 additions and 8 deletions

View File

@@ -103,9 +103,6 @@
} }
}, },
onLoad() { onLoad() {
uni.$on('onReceiveMessage', (msg) => {
this.getConversationList()
})
uni.$on('onConnectionStatusChange', (status) => { uni.$on('onConnectionStatusChange', (status) => {
this.connection = status this.connection = status
}) })
@@ -113,10 +110,15 @@
onShow() { onShow() {
if (this.$store.state.token !== '') { if (this.$store.state.token !== '') {
this.getConversationList() this.getConversationList()
} }
uni.$on('onReceiveMessage', (msg) => {
console.log('收到消息,刷新列表');
this.getConversationList()
})
this.isShown = true this.isShown = true
}, },
onHide() { onHide() {
uni.$off('onReceiveMessage')
this.isShown = false this.isShown = false
}, },
onNavigationBarButtonTap(e) { onNavigationBarButtonTap(e) {

View File

@@ -108,9 +108,6 @@
} }
}) })
}, },
beforeDestroy() {
uni.$off('onReceiveMessage')
},
methods: { methods: {
initMessageList() { initMessageList() {
this.getMessageList() this.getMessageList()