app.vue
//监听点击通知栏
plus.push.addEventListener('click', function(message) {
uni.$emit('toChat',{
currentUserId:message.payload.fromId,
username:message.payload.username
})
});
index.vue
toChat(currentUserId,username){
this.currentUserId = currentUserId
uni.navigateTo({
url:'/pages/chat/chat?currentUserId='+currentUserId+"&mineId="+this.mineId+"&username="+username
})
},
<user v-if="mineId!=item._id"
:item="item"
@click.native="toChat(item._id,item.username)"
></user>
chat.vue
async onLoad({currentUserId,mineId,username}) {
this.currentUserId = currentUserId
......
}
<text>{{currentUSerId}}</text>