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

淘宝天猫优惠券网站建设拔萝卜视频播放在线观看免费

淘宝天猫优惠券网站建设,拔萝卜视频播放在线观看免费,深圳福田最大网站公司,怎么劝客户做网站数据大屏表格数据,当表格内容超出(出现滚动条)时,无限循环滚动播放,鼠标移入暂停滚动,鼠标移除继续滚动;数据量小没有超出时不需要滚动。 *使用时应注意,滚动区域高度父元素高度 - 表…

数据大屏表格数据,当表格内容超出(出现滚动条)时,无限循环滚动播放,鼠标移入暂停滚动,鼠标移除继续滚动;数据量小没有超出时不需要滚动。
*使用时应注意,滚动区域高度=父元素高度 - 表头高度
1、组件内容

import React, { useState, useEffect, useRef } from "react";
import { Table } from "antd";
import { ColumnsType, TableRef } from "antd/lib/table";
import styles from "./styles.less";
import Nodate from "../Other/nodata";interface InfiniteScrollTableProps<T> {/** 表格数据源 */dataSource: T[];/** 表格列定义 */columns: ColumnsType<T>;/*** 唯一字段*/rowKeyField: string;/*** 滚动速率。* @default 0.5* @description 建议在 0.5-3 之间调整* */speed?: number;
}/*** @description 无限循环滚动table*/
const InfiniteScrollTable = <T = any,>(props: InfiniteScrollTableProps<T>) => {const { dataSource, columns, speed = 0.5, rowKeyField = "key" } = props;const [doubleData, setDoubleData] = useState<any[]>([]);const tableRef = useRef<TableRef>(null);const animationRef = useRef<number | null>(null);const isHovered = useRef(false);// 滚动高度const scrollHeight = useRef(0);// 滚动动画const startScrolling = (begin: boolean) => {if (isHovered.current || !tableRef.current || !tableHasScroll()) return;const table = tableRef.current.nativeElement;const wrapper = table.querySelector(".ant-table-body");if (!wrapper) {return;}// 重置滚动位置if (begin) {wrapper.scrollTop = 0;}const scroll = () => {if (isHovered.current) return;// 滚动到底部时重置位置if (wrapper.scrollTop >= wrapper.scrollHeight / 2) {wrapper.scrollTop = 0;} else {wrapper.scrollTop += speed;}animationRef.current = requestAnimationFrame(scroll);};animationRef.current = requestAnimationFrame(scroll);};// 表格内容是否出现滚动const tableHasScroll = () => {const table = tableRef.current?.nativeElement;const wrapper = table?.querySelector(".ant-table-body");if (!wrapper) {return false;}const hasScroll = wrapper.scrollHeight > wrapper.clientHeight;return hasScroll;};// 停止滚动const stopScrolling = () => {if (animationRef.current) {cancelAnimationFrame(animationRef.current);animationRef.current = null;}};// 处理鼠标事件const handleMouseEnter = () => {isHovered.current = true;stopScrolling();};const handleMouseLeave = () => {isHovered.current = false;startScrolling(false);};useEffect(() => {// 先设置为初始数据setDoubleData([...dataSource]);}, [dataSource]);// 开始滚动useEffect(() => {// 创建两倍数据用于实现无缝滚动if (tableHasScroll() && doubleData.length === dataSource.length) {setDoubleData([...dataSource, ...dataSource]);}startScrolling(true);return () => stopScrolling();}, [tableRef.current, doubleData]);return (<divref={(el) => (scrollHeight.current = el?.clientHeight || 0)}className={styles["infinite-scroll-table"]}onMouseEnter={handleMouseEnter}onMouseLeave={handleMouseLeave}><Tableref={tableRef}columns={columns}dataSource={doubleData}pagination={false}scroll={{ y: scrollHeight.current - 57 }}rowClassName={(record, index) =>index % 2 === 0 ? styles["even-row"] : styles["odd-row"]}rowKey={(record: any, index) => (record?.[rowKeyField] ?? "") + index}/></div>);
};export default InfiniteScrollTable;

2、样式

.infinite-scroll-table {position: relative;height: 100%;transition: all 0.3s ease;border: 1px solid rgba(187,187,187,1);.highlight {color: #40a9ff;font-weight: 600;}.even-row {background: rgba(255,255,255);height: 60px;}.odd-row {background: rgba(250,250,250);height: 60px;}:global {.ant-table-header{border-radius: 0;}.ant-table-thead > tr > th {background: rgba(242,242,242) !important;color: #333 !important;font-size: 14px;font-weight: 600;text-align: center;border-start-start-radius: 0 !important;border-start-end-radius: 0 !important;}.ant-table-body {scrollbar-width: none;-ms-overflow-style: none;}.ant-table-cell{font-weight: normal;font-size: 14px;}.ant-table-body::-webkit-scrollbar {display: none;}.ant-table-row:hover > td {background: rgba(64, 144, 255, 0.2) !important;}.ant-table-placeholder .ant-table-cell{border: none;}}}

文章转载自:

http://mzbkMAE3.bnLkc.cn
http://RxNuubyj.bnLkc.cn
http://BWESKHv7.bnLkc.cn
http://J9LOk19L.bnLkc.cn
http://iLVI6G7K.bnLkc.cn
http://oqf2RvaK.bnLkc.cn
http://Xrr2sU7C.bnLkc.cn
http://VHat4HGw.bnLkc.cn
http://tL8n0odU.bnLkc.cn
http://Dx6pQxJQ.bnLkc.cn
http://m1jZoLmr.bnLkc.cn
http://nC8CssE6.bnLkc.cn
http://PcorhIE2.bnLkc.cn
http://qe3f6Ko4.bnLkc.cn
http://ULNyKgFe.bnLkc.cn
http://tRQCEP1E.bnLkc.cn
http://DVzldKlJ.bnLkc.cn
http://dBN1ZImE.bnLkc.cn
http://WYaVEh2j.bnLkc.cn
http://fCat42E5.bnLkc.cn
http://qqd4u2x5.bnLkc.cn
http://WY5ju86e.bnLkc.cn
http://jZ8Ch11m.bnLkc.cn
http://YA7vO7dr.bnLkc.cn
http://OpsF9Tue.bnLkc.cn
http://E14OloRm.bnLkc.cn
http://yABBCUwF.bnLkc.cn
http://LBLZib8j.bnLkc.cn
http://7haXpwft.bnLkc.cn
http://7QWPa6OW.bnLkc.cn
http://www.dtcms.com/wzjs/682612.html

相关文章:

  • 福建建设厅安全员报名网站高档网站设计公司
  • 学校网站建设计划互动性的网站
  • 做网站是数据库应该放在哪里厦门做网站设计
  • 网站建设具体需求招聘广告模板
  • 建立网站考虑的三大要素高端网站定制费用是多少
  • 界首网站优化公司二手车网站建设论文
  • 网站设计的流程是什么上海地区网站开发公司
  • 义乌网站建设多少钱wordpress的pjax主题
  • ps做好的网站如何做链接app运营一般多少钱一个月
  • 网站外链怎么发布东莞建设通网站
  • 怎么知道网站用什么软件做的代理公司注册地址
  • 个人站长做网站wordpress发布文章关键词
  • 企业网站排名关键wordpress class类
  • 英文网站怎么做外贸推广seo海外
  • 怎么在互联网上建立网站wordpress 截取文章
  • 江门网站自助建站wordpress插件不会用
  • 服装设计网站怎么做安徽省工程招标信息网
  • 策划文案的网站图木舒克市建设局网站
  • 成都高端定制网站dz网站源码
  • 搭建一个网站 优帮云iapp如何用网站做软件
  • 做动态h5的网站万网搭建wordpress
  • 网站第三方统计工具android手机版下载
  • 专做眼镜的网站冯耀宗seo视频教程
  • 推荐12个国外免费自助建站网站重庆直播网站平台建设
  • 建英语网站好网站建设编辑教程
  • 房子已交房 建设局网站查不到外企网站建设服务公司
  • 惠州建设工程造价管理站网站整屏幕滑动的网站
  • 自己的网站怎么做wordpress 地区联动
  • 怎么做彩票网站平台wordpress related posts
  • 常州城乡建设局网站首页网页传奇网址