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%);
    }
}
相关推荐
万少8 小时前
HarmonyOS 开发必会 5 种 Builder 详解
前端·harmonyos
橙序员小站11 小时前
Agent Skill 是什么?一文讲透 Agent Skill 的设计与实现
前端·后端
炫饭第一名13 小时前
速通Canvas指北🦮——基础入门篇
前端·javascript·程序员
王晓枫13 小时前
flutter接入三方库运行报错:Error running pod install
前端·flutter
符方昊13 小时前
React 19 对比 React 16 新特性解析
前端·react.js
ssshooter13 小时前
又被 Safari 差异坑了:textContent 拿到的值居然没换行?
前端
曲折14 小时前
Cesium-气象要素PNG色斑图叠加
前端·cesium
Forever7_14 小时前
Electron 淘汰!新的桌面端框架 更强大、更轻量化
前端·vue.js
不会敲代码114 小时前
前端组件化样式隔离实战:React CSS Modules、styled-components 与 Vue scoped 对比
css·vue.js·react.js
Angelial14 小时前
Vue3 嵌套路由 KeepAlive:动态缓存与反向配置方案
前端·vue.js