A页面
onTotalUnreadMessageCountUpdated (event){
this.globalData.totalUnreadCount=event.data
uni.$emit('totalUnreadCount',{totalUnreadCount:event.data})
},
B页面
getNum(){
let self=this
uni.$on('totalUnreadCount',function(data){
// if(data.totalUnreadCount==0) return
this.$nextTick(()=>{
self.totalUnreadCount= data.totalUnreadCount
})
})
},
使用 this.$nextTick()即可重新渲染当前页面