前端uniapp列表下拉到底部加载下一页列表【下拉加载页面/带源码/实战】

目录

    • 一. 图片
      • 1.
      • 2.
    • 二.list.vue
    • 三.uni-load-more.vue
    • 最后

一. 图片

1.

请添加图片描述

2.

请添加图片描述

二.list.vue

<template><view><!--列表--><scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" lower-threshold="50"@scrolltoupper="scrolltoupperFunc" @scrolltolower="scrolltolowerFunc"><view class="p-0-30 bg-white"><view class="d-b-c border-b p-20-0" v-for="(item,index) in tableData" :key="index"><view class="d-s-s f-w d-c flex-1"><text class="30">提现</text><text class="gray9 f22">{{item.create_time}}</text></view><view><text:class="item.apply_status.text=='审核通过'?'green':'gray9'">{{ item.apply_status.text }}</text><text class="red ml20"> {{ item.money }}元</text></view></view><!--<view class=""><view class="bottom-refresh"><view class="d-c-c p30" v-if="tableData.length && no_more"><text class="gray3">亲, 没有更多了</text></view><view v-if="loading" class="d-c-c p30"><text class="gray3">加载中...</text></view></view></view>--><!-- 没有记录 --><view class="d-c-c p30" v-if="tableData.length==0 && !loading"><text class="iconfont icon-wushuju"></text><text class="cont">亲,暂无相关记录哦</text></view><uni-load-more v-else :loadingType="loadingType"></uni-load-more></view></scroll-view></view>
</template><script>import uniLoadMore from "@/components/uni-load-more.vue";export default {components: {uniLoadMore},data() {return {/*手机高度*/phoneHeight: 0,/*可滚动视图区域高度*/scrollviewHigh: 0,/*状态选中*/state_active: -1,/*数据列表*/tableData: [],no_more: false,loading: true,/*最后一页码数*/last_page: 0,/*当前页面*/page: 1,/*每页条数*/list_rows: 20,tableList: [],}},computed: {/*加载中状态*/loadingType() {if (this.loading) {return 1;} else {if (this.tableData.length != 0 && this.no_more) {return 2;} else {return 0;}}}},mounted() {/*初始化*/this.init();/*获取数据*/this.getData();},methods: {/*初始化*/init() {let self = this;uni.getSystemInfo({success(res) {self.phoneHeight = res.windowHeight;self.scrollviewHigh = res.windowHeight;}});},/*获取数据*/getData() {let self = this;let page = self.page;self.loading = true;let list_rows = self.list_rows;self._get('user.cash/lists', {status: -1,page: page || 1,list_rows: list_rows,}, function(data) {self.loading = false;self.tableData = self.tableData.concat(data.data.list.data);self.last_page = data.data.list.last_page;if (data.data.list.last_page <= 1) {self.no_more = true;return false;}});},/*切换*/stateFunc(e) {let self = this;if (e != self.state_active) {self.tableData = [];self.page = 1;self.state_active = e;self.getData();}},/*可滚动视图区域到顶触发*/scrolltoupperFunc() {console.log('滚动视图区域到顶');},/*可滚动视图区域到底触发*/scrolltolowerFunc() {let self = this;if (self.page < self.last_page) {self.page++;self.getData();}self.no_more = true;}}}
</script><style></style>

三.uni-load-more.vue

<template><view class="load-more"><view class="loading-img" v-show="loadingType === 1 && showImage"><view class="load1"><view :style="{background:color}"></view><view :style="{background:color}"></view><view :style="{background:color}"></view><view :style="{background:color}"></view></view><view class="load2"><view :style="{background:color}"></view><view :style="{background:color}"></view><view :style="{background:color}"></view><view :style="{background:color}"></view></view><view class="load3"><view :style="{background:color}"></view><view :style="{background:color}"></view><view :style="{background:color}"></view><view :style="{background:color}"></view></view></view><text class="loading-text" :style="{color:color}">{{loadingType === 0 ? contentText.contentdown : (loadingType === 1 ? contentText.contentrefresh : contentText.contentnomore)}}</text></view>
</template><script>export default {name: "load-more",props: {loadingType: {//上拉的状态:0-loading前;1-loading中;2-没有更多了type: Number,default: 0},showImage: {type: Boolean,default: true},color: {type: String,default: "#999999"},contentText: {type: Object,default () {return {contentdown: "上拉显示更多",contentrefresh: "正在加载...",contentnomore: "已经到底了"};}}},data() {return {}}}
</script><style>.load-more {display: flex;flex-direction: row;height: 80upx;align-items: center;justify-content: center;}.loading-img {height: 24px;width: 24px;margin-right: 10px;}.loading-text {font-size: 24upx;color: #999;}.loading-img>view {position: absolute;}.load1,.load2,.load3 {height: 24px;width: 24px;}.load2 {transform: rotate(30deg);}.load3 {transform: rotate(60deg);}.loading-img>view view {width: 6px;height: 2px;border-top-left-radius: 1px;border-bottom-left-radius: 1px;background: #777;position: absolute;opacity: 0.2;transform-origin: 50%;-webkit-animation: load 1.56s ease infinite;}.loading-img>view view:nth-child(1) {transform: rotate(90deg);top: 2px;left: 9px;}.loading-img>view view:nth-child(2) {-webkit-transform: rotate(180deg);top: 11px;right: 0px;}.loading-img>view view:nth-child(3) {transform: rotate(270deg);bottom: 2px;left: 9px;}.loading-img>view view:nth-child(4) {top: 11px;left: 0px;}.load1 view:nth-child(1) {animation-delay: 0s;}.load2 view:nth-child(1) {animation-delay: 0.13s;}.load3 view:nth-child(1) {animation-delay: 0.26s;}.load1 view:nth-child(2) {animation-delay: 0.39s;}.load2 view:nth-child(2) {animation-delay: 0.52s;}.load3 view:nth-child(2) {animation-delay: 0.65s;}.load1 view:nth-child(3) {animation-delay: 0.78s;}.load2 view:nth-child(3) {animation-delay: 0.91s;}.load3 view:nth-child(3) {animation-delay: 1.04s;}.load1 view:nth-child(4) {animation-delay: 1.17s;}.load2 view:nth-child(4) {animation-delay: 1.30s;}.load3 view:nth-child(4) {animation-delay: 1.43s;}@-webkit-keyframes load {0% {opacity: 1;}100% {opacity: 0.2;}}
</style>

最后

感觉文章好的话记得点个心心和关注和收藏,有错的地方麻烦指正一下,如果需要转载,请标明出处,多谢!!!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/189435.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

股票价格预测 | Python实现基于CNN卷积神经网络的股票预测模型(keras,Conv1D)

文章目录 效果一览文章概述源码设计参考资料效果一览 文章概述 股票价格预测 | Python实现基于CNN卷积神经网络的股票预测模型(keras) 源码设计 import quandl import datetimedf = quandl

Jenkins自动化部署一个Maven项目

Jenkins自动化部署 提示&#xff1a;本教程基于CentOS Linux 7系统下进行 Jenkins的安装 1. 下载安装jdk11 官网下载地址&#xff1a;https://www.oracle.com/cn/java/technologies/javase/jdk11-archive-downloads.html 本文档教程选择的是jdk-11.0.20_linux-x64_bin.tar.g…

如何优化谷歌商店里应用的评分评论2

在做应用评分优化前&#xff0c;我们需要考虑用户以及他们如何在不浪费太多时间的情况下分享反馈。 1、及时妥善的回复评论。 许多潜在用户在决定下载应用之前都会查看评论。回复正面和负面评论&#xff0c;向用户表明我们重视他们的反馈。回复用户评论是一个改善应用公众形象…

AODNet

【20231117】读研期间没有对阅读的文章进行总结&#xff0c;没想到毕业反而有了机会。即日起会对阅读过的文章要点进行梳理记录&#xff0c;希望这一习惯能够坚持下去。 学术的角度&#xff1a;看论文要学习作者如何逻辑严谨的自证 落地的角度&#xff1a;只用看以下六点&#…

一个美观且功能丰富的 .NET 控制台应用程序开源库

推荐一个美观且功能丰富的 .NET 控制台应用程序开源库&#xff0c;从此告别黑漆漆的界面。 01 项目简介 Spectre.Console 是一个开源的 .NET 库&#xff0c;用于创建美观、功能丰富的控制台&#xff08;命令行&#xff09;应用程序。它提供了一组易于使用的 API&#xff0c;…

cocos----刚体

刚体&#xff08;Rigidbody&#xff09; 刚体&#xff08;Rigidbody&#xff09;是运动学&#xff08;Kinematic&#xff09;中的一个概念&#xff0c;指在运动中和受力作用后&#xff0c;形状和大小不变&#xff0c;而且内部各点的相对位置不变的物体。在 Unity3D 中&#xff…

C#WPF用户控件及自定义控件实例

本文演示C#WPF自定义控件实例 用户控件(UserControl)和自定义控件(CustomControl)都是对UI控件的一种封装方式,目的都是实现封装后控件的重用。 只不过各自封装的实现方式和使用的场景上存在差异。 1 基于UserControl 创建 创建控件最简单一个方法就是基于UserControl …

无线物理层安全大作业

这个标题很帅 Beamforming Optimization for Physical Layer Security in MISO Wireless NetworksProblem Stateme![在这里插入图片描述](https://img-blog.csdnimg.cn/58ebb0df787c4e23b0c7be4189ebc322.png) Beamforming Optimization for Physical Layer Security in MISO W…

DOA估计算法——Capon算法

1.波速形成基本思想 在理解Capon算法之前&#xff0c;我们有必要先了解波束形成的基本思想以及原理到底是什么。这有助于我们更好的理解Capon算法的思想。 图 1 如图1展示了均匀阵列波束导向的示意图。图中wm表示加权值&#xff0c;波速形成(DBF)的基本思想就是将各阵元输出进…

[ 云计算 | AWS ] AI 编程助手新势力 Amazon CodeWhisperer:优势功能及实用技巧

文章目录 一、Amazon CodeWhisperer 简介1.1 CodeWhisperer 是什么1.2 Amazon CodeWhisperer 是如何工作的 二、Amazon CodeWhisperer 的优势和功能2.1 Amazon CodeWhisperer 的优势2.2 Amazon CodeWhisperer 的代码功能 三、Amazon CodeWhisperer 安装3.1 安装到 IntelliJ IDE…

Android——Gradle插件项目根目录settings.gradle和build.gradle

一、settings.gradle结构分析 项目根目录下的settings.gradle配置文件示例&#xff1a; pluginManagement {/*** The pluginManagement.repositories block configures the* repositories Gradle uses to search or download the Gradle plugins and* their transitive depen…

数智竞技何以成为“科技+体育”新样本?

文 | 智能相对论 作者 | 青月 “欢迎来到&#xff0c;钢铁突袭。” 三人一组&#xff0c;头戴VR设备&#xff0c;中国香港队和泰国队在数实融合的空间里捉对厮杀&#xff0c;通过互相射击对方能量铠甲获取积分。 虽然双方都展现出了极强的机动性&#xff0c;但显然中国香港队…