当前位置: 首页 > news >正文

微信小程序~上推加载更多组件

本组件使用的是Taro+React 实现的 ,具体代码如下
一共分为tsx和less文件

//index.tsx
/** RefreshLoading* @description 上推加载更多组件* @param loading boolean* @param style* @returns*/import { View } from "@tarojs/components";
import React, { FC } from "react";
import styles from "./styles.module.less";interface IProps {loading: boolean;style?: React.CSSProperties;hasMore?: boolean;
}const RefreshLoading: FC<IProps> = ({loading = false,style = {},hasMore = true,
}) => {return (<View className={styles.wrap}>{loading ? (<View className={styles.refreshLoading} style={style}><View className={styles.animate}>{[1, 2, 3].map((item) => (<View className={styles.point} key={item} />))}</View><View className={styles.text}>数据加载中</View></View>) : !hasMore ? (<View className={styles.hasMore}>没有更多了</View>) : (<></>)}</View>);
};export default RefreshLoading;
//less文件
.wrap {padding: 0 0 10px 0;
}.refreshLoading {display: flex;align-items: center;justify-content: center;padding: 4px 0;.animate {font-size: 0;.point {display: inline-block;width: 12 * 0.5px;height: 12 * 0.5px;margin-right: 4 * 0.5px;background: #00c8c8;border-radius: 50%;animation: load 0.65s ease infinite;&:last-child {margin-right: 0;}&:nth-of-type(1) {animation-delay: 0.13s;}&:nth-of-type(2) {animation-delay: 0.26s;}&:nth-of-type(3) {animation-delay: 0.39s;}}}.text {margin-left: 8px;color: #999;font-size: 12px;}
}.hasMore {text-align: center;color: #999;font-size: 12px;
}@keyframes load {0% {opacity: 1;}100% {opacity: 0;}
}

具体使用如下
在这里插入图片描述

在这里插入图片描述

相关文章:

  • Vue 插槽讲解
  • Docker 基础篇
  • js复杂数据类型如何转变为字符串
  • MySQL 函数参考手册(MySQL 日期函数)
  • 【Linux】Linux环境基础开发工具使用
  • STM32通用定时器、计数器
  • 能替代微软AD的国产化方案,搭建自主可控的身份管理体系
  • idea创建golang项目
  • Mov转MP4怎么转换?如何播放mov视频?
  • OpenGL ES 渲染 NV21、NV12 格式图像有哪些“姿势”?
  • 机器狗行业调研:全球市场规模将达到数十亿美元
  • 【C++】C++入门基础讲解(一)
  • 算法沉淀——滑动窗口(leetcode真题剖析)
  • 【01】Linux 基本操作指令
  • 关于达梦认证DCA DCP,TIDB认证PCTA PCTP考试那点事儿
  • (三)从jvm层面了解线程的启动和停止
  • [case10]使用RSQL实现端到端的动态查询
  • electron原来这么简单----打包你的react、VUE桌面应用程序
  • ERLANG 网工修炼笔记 ---- UDP
  • go append函数以及写入
  • golang 发送GET和POST示例
  • HashMap ConcurrentHashMap
  • input的行数自动增减
  • java B2B2C 源码多租户电子商城系统-Kafka基本使用介绍
  • Js实现点击查看全文(类似今日头条、知乎日报效果)
  • MobX
  • XForms - 更强大的Form
  • 从零开始的webpack生活-0x009:FilesLoader装载文件
  • - 概述 - 《设计模式(极简c++版)》
  • 观察者模式实现非直接耦合
  • 基于OpenResty的Lua Web框架lor0.0.2预览版发布
  • 基于遗传算法的优化问题求解
  • 利用阿里云 OSS 搭建私有 Docker 仓库
  • 时间复杂度与空间复杂度分析
  • 腾讯大梁:DevOps最后一棒,有效构建海量运营的持续反馈能力
  • 用quicker-worker.js轻松跑一个大数据遍历
  • 职业生涯 一个六年开发经验的女程序员的心声。
  • 7行Python代码的人脸识别
  • puppet连载22:define用法
  • python最赚钱的4个方向,你最心动的是哪个?
  • 如何用纯 CSS 创作一个货车 loader
  • ​ubuntu下安装kvm虚拟机
  • ​浅谈 Linux 中的 core dump 分析方法
  • ‌JavaScript 数据类型转换
  • #HarmonyOS:基础语法
  • #pragma once
  • (10)STL算法之搜索(二) 二分查找
  • (175)FPGA门控时钟技术
  • (2)nginx 安装、启停
  • (C#)if (this == null)?你在逗我,this 怎么可能为 null!用 IL 编译和反编译看穿一切
  • (el-Transfer)操作(不使用 ts):Element-plus 中 Select 组件动态设置 options 值需求的解决过程
  • (floyd+补集) poj 3275
  • (翻译)Quartz官方教程——第一课:Quartz入门
  • (附源码)springboot太原学院贫困生申请管理系统 毕业设计 101517
  • (紀錄)[ASP.NET MVC][jQuery]-2 純手工打造屬於自己的 jQuery GridView (含完整程式碼下載)...