<template> <view class="tcVisit_page"> <view v-if="historyList.length"> <view class="evaluation_box lh26" v-for="(item,index) in historyList" :key="index"> <view> <text><b>姓名:</b> {{ item.name }} </text> </view> <view> <text><b>电话:</b> {{ item.phone }} </text> </view> </view> </view> <view v-else class="noVote"> <view class="img" style="text-align:center;"> <img src="/static/img_jidu/parent/empty.png" alt=""> <text class="">暂无数据</text> </view> </view> </view> </view></template>
<script> import { getList } from '@/api/visit.js' export default { data() { return { isOver:false, campus:[], historyList: [], pageInfo: { page: "1", limit: 10, }, } }, onLoad() { getList(this.pageInfo).then(res => { this.historyList = res }) }, onShow(){ document.title="记录"; }, methods: { // 下拉到底部后加载新数据 onReachBottom() { //判断下一页是否存在数据,不存在将显示暂无数据等提示语 if (!this.isOver) { this.pageInfo.page++; //页数加一 this.findData(); //回调接口 } }, findData() { getList(this.pageInfo).then(res => { if (res.length < this.pageInfo.limit) this.isOver = true; for (let i = 0; i < res.length; i++) { this.historyList.push(res[i]); } }) } } }</script>