<template>
<view class="u-page">
<u-list @scrolltolower="scrolltolower">
<u-list-item v-for="(item, index) in userList" :key="index">
<u-cell>
<u-avatar slot="icon" shape="square" size="35" @click="toChat(index)"
customStyle="margin: -3px 5px -3px 0">{{item.userName}}--{{item.userCode}}</u-avatar>
</u-cell>
</u-list-item>
</u-list>
</view>
</template>
<script>
import {
getUserList
} from '@/common/http/api.js';
export default {
data() {
return {
userList: []
}
},
onLoad() {
this.getUserList()
},
methods: {
scrolltolower() {
this.getUserList()
},
async getUserList() {
const res = await getUserList()
//console.log(res)
for (let x in res) {
this.userList.push(res[x])
}
//console.log(this.userList)
},
toChat(e){
//console.log(e)
//console.log(this.userList[e].userName)
let userCode = this.userList[e].userCode
const url = "/pages/chat/chat?userCode="+userCode
uni.navigateTo({
url
})
}
},
}
</script>
<style>
</style>
浏览器和微信小程序能跳转,但是打包成app后好友页面就无法跳转