<view>
//current判断不同页面
<u-tabs :offset=[2,120] class="tabs" :list="cates" bg-color="#f8f8f8" font-size="40" :is-scroll="false":current="current" @change="change" @click="logan(index)"></u-tabs>
</view>
data(){
return(){
current: 0,
}
}
//凋接口
onLoad() {
this.getWaitingProcessing()
},
onReachBottom() {
this.pageIndex += 1
this.getWaitingProcessing()
},
//方法里面写接口方法
methods: {
getWaitingProcessing() {
const data = {
pageIndex: 1,
// search:'',
isUp: true,
distributeReadMessageUserDetailId: 0,
size: 10,
isAll: false,
//判断current的值过滤数据
status: this.current === 1 ? '已送达' : '已阅',
// isAll:false,
// status:'已阅'
}
this.$api.gettoberead(data).then(res => {
console.log(res, '待阅信息')
//角标数量
if (this.current === 0) {
this.cates[0].count = res.Result.data.length
}
//获取后台数据更新到list
if (this.pageIndex === 1) {
this.list = res.Result.data
} else {
this.list.push(...res.Result.data)
}
//触底显示没有更多了
if (res.Result.data.length < 0) {
this.status = 'loading'
} else {
this.status = 'noMore'
}
})
},
//重新更新页面
change(index) {
this.current = index;
console.log(index)
this.getWaitingProcessing()
}
uniapp两个接口渲染到同一个页面(笔记)
最新推荐文章于 2024-07-25 20:50:48 发布