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%);
    }
}
相关推荐
之歆28 分钟前
Vue商品详情与放大镜组件
前端·javascript·vue.js
再吃一根胡萝卜1 小时前
如何把小米 MiMo 接入 CodeBuddy,打造私有 Agent
前端
负责的蛋挞2 小时前
异步HttpModule的实现方式
java·服务器·前端
YFF菲菲兔3 小时前
其他 Hooks 解析
react.js
丹宇码农5 小时前
把 HLS 字幕玩出花:zwPlayer 如何让 M3U8 视频支持全文搜索、翻译与码率自适应
前端·javascript·音视频·hls·视频播放器
2501_943782355 小时前
【共创季稿事节】猜数字游戏:二分法思维与交互式反馈
前端·游戏·microsoft·harmonyos·鸿蒙·鸿蒙系统
GV191rLvq5 小时前
基于Socket实现的最简单的Web服务器【ASP.NET原理分析】
服务器·前端·asp.net
吠品5 小时前
LangChain 里 tool_call_id 为空?一次 MCP 工具集成的排查记录
前端
微信开发api-视频号协议6 小时前
企业微信二次开发中的文件系统设计:媒体资源、临时文件与业务附件
前端·微信·企业微信·媒体·ipad·微信开放平台