react的ul li滚动列表

父组件

css 复制代码
  <NewOrderRoll orderGroup={orderGroup} />

组件

javascript 复制代码
import './newOrderRoll.less';

const newOrderRoll = (orderGroup: any) => {

    const handle = (data: String): String[] => {
        return data.split(':');
    }



    return (
        <>
            <div className="scroll_page">
                <ul className='scroll_page-head'>
                    <li>订单编号</li>
                    <li>销售员</li>
                    <li>用户</li>
                    <li>销售额(元)</li>
                    <li>下单日期</li>
                </ul>
                <div className="ul-wrapper">
                    <ul className="scroll_page-item">
                        {
                            orderGroup?.orderGroup.map((order: String, index: any) => {
                                const tempData = handle(order);
                                return <ul key={index} className='scroll_page-item-ul flex-center'>{
                                    tempData.map((item: String, key: any) => {
                                        return <li key={key}>{item}</li>
                                    })
                                }</ul>
                            })
                        }
                    </ul>
                </div>
            </div>
        </>
    )
}

export default newOrderRoll;
css 复制代码
.scroll_page {
    margin: 0;
    padding: 2px 0;
    list-style: none;
    overflow: hidden;
    border: 1px #5d70ea solid;
    font-size: 16px;
    text-align: center;
    // background-color: #5d70ea;
    opacity: 0.5;
    // height: ~'calc(299px / 1920px * 100%)';
    height: 20vh;


    &-head {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 30px;

        &>li {
            text-align: center;
            background: rgba(255, 255, 255, 0.14);
            width: 20%;
            font-size: 11px;
            font-weight: 500;
            color: #96D3FE;
            line-height: 32px;
        }
    }

    .ul-wrapper {
        position: relative;
        height: 100%;
        overflow: hidden;
    }

    &-item:hover {// 鼠标经过暂停
        animation-play-state: paused;
    }

    &-item {// infinite 无限滚动 linear匀速 anim 名称 normal默认值(结束后再从头开始)
        height: 100%;
        animation: 15s anim linear infinite normal;

        &-ul {
            width: 100%;
            justify-content: space-between;

            &>li {
                width: 25%;
                text-align: center;
                margin: 0;
                padding: 0 4px;
                font-size: 11px;
                height: 30px;
                line-height: 30px;
                color: #96D3FE;
            }
        }
    }
}

@keyframes anim {

    0% {
        transform: translateY(-0%);
    }

    100% {
        transform: translateY(-100%);
    }
}
相关推荐
李剑一20 分钟前
uni-app实现leaflet地图图标旋转
前端·trae
风度前端1 小时前
npm 2026安全新规下的免登录发包策略
前端
冴羽1 小时前
2026 年前端必须掌握的 4 个 CSS 新特性!
前端·javascript·css
rgeshfgreh1 小时前
Python流程控制:从条件到循环实战
前端·数据库·python
狗头大军之江苏分军1 小时前
告别旧生态:Ant Design 6 不再支持 IE 与现代前端趋势解读
前端·javascript·后端
C_心欲无痕1 小时前
nginx - 开启 gzip 压缩
运维·前端·nginx
闲云一鹤2 小时前
2026 最新 ComfyUI 教程 - 本地部署 AI 生图模型 - Z-Image-Turbo
前端·人工智能·ai编程
开开心心_Every2 小时前
安卓后台录像APP:息屏录存片段,行车用
java·服务器·前端·学习·eclipse·edge·powerpoint
狗头大军之江苏分军2 小时前
Ant Design 6.0 正式发布:从 V5 到 V6 有哪些变化?
前端
Highcharts.js2 小时前
Highcharts Grid 表格/网格安装 |官方安装文档说明
开发语言·javascript·表格组件·highcharts·官方文档·安装说明·网格组件