JS

import React from 'react'
import styles from './style.less'
import { AntCloudOutlined, AccountBookOutlined } from '@ant-design/icons';
import { Carousel } from 'antd'
const data = [{ name: '羽神', money: -20000, wage: 6000, consume: 7000 },{ name: '陈笑豪', money: 800, wage: 1000, consume: 1200 },{ name: '赵老威', money: 1300, wage: 14000, consume: 12800 },{ name: '铜锣湾扛把子', money: 8700, wage: 7200, consume: 7000 },{ name: '少主', money: 7000, wage: 4500, consume: 3200 },{ name: '街口', money: -10000, wage: 4000, consume: 4800 },{ name: '老羊', money: 320, wage: 0, consume: 2400 },{ name: '孙浩', money: 10000, wage: 8000, consume: 4000 },{ name: '郭帅', money: 100000, wage: 12000, consume: 8000 },
]
const split_array = (arr, length) =>
{  // arr 是需要拆分的数组 length 是要拆分小数组的数量let a_length = arr.lengthlet result = []  // 结果数组for (let i = 0; i < a_length; i += length)  {result.push(arr.slice(i, i + length))  // 循环遍历原数组的 N 个元素 每次取从上次取的下一个开始取}return result  // 把结果数组 return
}const itemDom = () =>
{let newData = split_array(data, 4)  // 每四个数组截取一个大数组return (// autoplay 自动播放  autoplaySpeed 播放间隔 5S<Carousel autoplay autoplaySpeed={5000} >{newData.map((item, index) =>{return <div key={index} className={styles.coreItemContainer}>{item.map((data, i) =>{return (<div key={i} className={styles.coreItem}><div className={styles.itemNav}><span className={styles.navTitle}>{data.name}</span><span className={styles.NavRound}></span></div><div className={styles.coreDetails}><div className={styles.detection}><span className={styles.detectionTitle}>金钱</span><span style={{ color: 'rgba(255, 255, 255, 1)' }} className={styles.detectionNumber}>{data.money}</span><span className={styles.detectionUnit}><AccountBookOutlined /></span></div><div className={styles.detection}><span className={styles.detectionTitle}>工资</span><span className={styles.detectionNumber}>{data.wage}</span><span className={styles.detectionUnit}><AccountBookOutlined /></span></div><div className={styles.detection}><span className={styles.detectionTitle}>消费</span><span style={{ color: 'rgba(255, 185, 128, 1)' }} className={styles.detectionNumber}>{data.consume}</span><span className={styles.detectionUnit}><AccountBookOutlined /></span></div></div></div>)})}</div>})}</Carousel>)
}
const index = () =>
{return (<div className={styles.container}><div className={styles.overall}><div className={styles.navBar}><div className={styles.navBarImg}><AntCloudOutlined className={styles.AntCloudOutlined} /></div><span className={styles.navBarSpan}>后陈荣耀</span></div><div className={styles.core}>{itemDom()}</div></div></div>)
}export default index

CSS

.container {position: relative;width: 100%;height: 100%;line-height: 1;text-align: center;.overall {margin: 200px auto;position: relative;width: 1000px;height: 276px;border-radius: 4px;box-sizing: border-box;background-color: hsl(214, 46%, 34%);line-height: 1.45;}img {width: 100%;height: 100%;}
}.navBar {display: flex;align-items: center;width: 100%;height: 60px;background: linear-gradient(0deg, #1B478F 0%, #151F2D 100%);.navBarImg {margin-left: 22px;width: 34px;height: 34px;.AntCloudOutlined {font-size: 34px;color: #fff;}}.navBarSpan {margin-left: 9px;font-size: 30px;font-weight: 600;color: #FFFFFF;text-shadow: 0px 2px 2px #1A86FF;background: linear-gradient(0deg, rgba(90, 203, 255, 1) 0%, rgba(26, 134, 255, 1) 100%);-webkit-background-clip: text;-webkit-text-fill-color: transparent;}
}.core {padding-top: 20px;width: 100%;height: calc(~'100% - 60px');text-align: left;.coreItemContainer {position: relative;.coreItem {display: inline-block;margin-left: 20px;padding: 13px 20px 0 20px;width: 226px;height: 155px;border: 1px solid #002E55;background: linear-gradient(0deg, #00437D 0%, #005192 100%);border-radius: 6px;.itemNav {display: flex;align-items: center;justify-content: space-between;font-size: 22px;font-weight: 500;color: #FFFFFF;width: 100%;height: 22px;.navTitle {font-size: 22px;font-weight: 500;color: #FFFFFF;}.NavRound {width: 14px;height: 14px;background: #00FF00;border-radius: 50%;}}}}.coreDetails {display: flex;flex-direction: column;margin-top: 16px;width: 100%;height: 96px;overflow: hidden;line-height: 32px;.detection {display: flex;justify-content: space-between;.detectionTitle {font-size: 18px;color: rgba(195, 240, 255, 1);}.detectionNumber {font-family: DINPro !important;flex: 1;text-align: right;font-size: 24px;color: rgba(0, 192, 255, 1);}.detectionUnit {width: 17px;margin-left: 10px;color: rgba(195, 240, 255, 1);}}}
}:global {.ant-carousel .slick-dots li.slick-active button {// 选中状态width: 12px;height: 12px;background: #00CCFF;border-radius: 50%;}.ant-carousel .slick-dots li.slick-active {// 选中向上1像素margin-top: -1px;}//   .ant-carousel .slick-dots li {//     margin-left: 3px !important;//     margin-right: 3px !important;//   }.ant-carousel .slick-dots li button {// 未选中的width: 12px;height: 12px;background: rgb(0, 204, 255, .4);border-radius: 50%;}.ant-carousel .slick-dots-bottom {// 切换位置bottom: -33px;}.ant-carousel .slick-dots li {position: relative;display: inline-block;-ms-flex: 0 1 auto;flex: 0 1 auto;box-sizing: content-box;width: 12px;height: 3px;margin: 0 2px;margin-right: 3px;margin-left: 3px;padding: 0;text-align: center;text-indent: -999px;vertical-align: top;// transition: all 0.5s;}.ant-carousel .slick-dots li.slick-active {width: 12px;}
}

antd 走马灯案例相关推荐

  1. antd走马灯组件自定义前进后退按钮

    antd走马灯组件自定义前进后退按钮[ts + react] antd的Carousel没有提供前进后退按钮需要自己根据文档 实现此功能 官方提供了next 和prev两个方法 next() 切换到下 ...

  2. antd 轮播图样式_React - AntD 走马灯组件前后切换面板

    1.先用AntD的图标来当做轮播图点击的两个按钮,并将Carousel与按钮放在一个父级下. 轮播图切换按钮 (this.slider = el)}> 1 2 3 4 2.轮播图的配置lunbo ...

  3. antd走马灯切换到相应图片

    1.先绑定这个方法到ref: 2.然后this.slider && this.slider.innerSlider.slickGoTo(pIndex);就可以跳转到相应页面,文档理的g ...

  4. 3小时快速入门html5+css(2022)

    字体图标-iconfont 1.引入样式表 2.引入内容 <link rel="stylesheet" href="./iconfont/iconfont.css& ...

  5. React_cli路由

    官方脚手架 安装 npm方式 npm install -g create-react-app create-react-app my-app npx方式 npx create-react-app my ...

  6. react+antd实现图片上传并且剪裁(请参照最新文章,此案例有bug)

    代码详情 (存在的bug:只有第一次上传剪裁是正确的,在不刷新页面的情况下再次进行剪裁会出现错误,目前没有找到解决办法.) 解决办法:点击上传按钮完成上传之后,按钮变为不能点击的状态,阻止bug的发生 ...

  7. vue框架根据antd封装的走马灯组件

    文章目录 CheckPhotos.vue PhotosBoard.vue 引用 CheckPhotos.vue <template><div class="check-ph ...

  8. Ant Design 3.0 使用案例

    代码地址如下: http://www.demodashi.com/demo/12309.html 本文适合对象 有过React使用经验. 有过webpack使用经验. 了解node. DEMO使用方式 ...

  9. 《大型网站技术架构:核心原理与案例分析》笔记05

    <大型网站技术架构:核心原理与案例分析>笔记05 网站的课扩展性架构: 扩展性:指对现有系统影响最小的情况下,系统功能可持续扩展或提升的能力.表现在系统基础设施稳定不需要经常变更,应用之间 ...

最新文章

  1. 【error】error: field * has incomplete type
  2. EMW 性能优化二之---并发配置
  3. DL之LSTM:基于《wonderland爱丽丝梦游仙境记》小说数据集利用LSTM算法(层加深,基于keras)对单个character字符预测
  4. JAVA学习笔记--初识容器类库
  5. [react] React中怎么检验props?
  6. Learning XNA 3.0翻译连载--序言
  7. 对于原始轨迹的噪声过滤方法和曲率计算方法
  8. 持续集成部署Jenkins工作笔记0001---持续集成、持续部署、持续交付的概念
  9. mie散射理论方程_亚琛工业大学 计算化学方向 之OPT学习笔记第一部分第一节 静态光散射...
  10. 北京自贸区国际商务服务片区挂牌 总面积48平方公里
  11. Unity之UnityWebRequest和使用
  12. CSS3 - 新单位vw、vh、vmin、vmax使用详解(附样例)
  13. 吴恩达Course1《神经网络与深度学习》week2:神经网络基础 测验及作业
  14. ImportError: /usr/local/lib/python3.7/dist-packages/cv2/cv2.cpython-37m-arm-linux-gnueabihf.so: unde
  15. FC总线基础知识(2)——光纤交换机
  16. 在服务器上设置虚拟传入,如何配置 SMTP 虚拟服务器以进行邮件传递
  17. scratch 学习网址:
  18. Unity Shader-后处理:景深
  19. 【操作系统二】图解TCP/IP模型+实战
  20. 校园二手市场开题报告范文

热门文章

  1. 安全行业的发展与现状
  2. 五一是深圳买新房的最佳时机吗?
  3. 使用Prometheus与Grafana追踪SpringBoot程序
  4. 动态添加 Redis 密码认证
  5. Keras中保存和加载权重及模型结构
  6. Windows下通过CMD脚本更改环境变量并马上生效
  7. 抛物线求积公式求积分算法matlab,基于Matlab的数值积分公式问题.doc
  8. 池化技术 java_netty4的内存池化技术
  9. 智能反射面(IRS)信道建模与仿真
  10. 农村小学计算机教育论文,浅谈现代信息技术在农村小学语文教学中的有效应用...