Blogger Information
Blog 51
fans 0
comment 1
visits 65041
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Uniapp上拉加载数据
鱼的熊掌
Original
764 people have browsed it
<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>
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post