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

Ant Design预览多张图

简单的多图预览配置,满足放大缩小关闭左右切换即可


import { Image } from "antd";DOM写法:
<Image.PreviewGroup preview={{ visible: imageVisible, current: currentPreviewIndex, onVisibleChange: (vis) => setImageVisible(vis) }} >{(frameCaptureList[0] || []).map((frameItem: any, frameIndex: number) => (<Image key={frameIndex} src={frameItem.url} preview={{ mask: false }} style={{ display: 'none' }} />))}
</Image.PreviewGroup>变量定义:
const [imageVisible, setImageVisible] = useState(false); // 是否预览图片
const [currentPreviewIndex, setCurrentPreviewIndex] = useState<number>(0); // 当前预览图片索引js逻辑:
// 当前预览图片点击事件
const onPreviewImage = (index) => {setImageVisible(true);setCurrentPreviewIndex(index);
}

上面是react的写法,其他框架写法类似

其他配置查看:图片 Image - Ant Design


文章转载自:
http://arriviste.sxnf.com.cn
http://biophysics.sxnf.com.cn
http://biociation.sxnf.com.cn
http://causeway.sxnf.com.cn
http://bicarbonate.sxnf.com.cn
http://changeling.sxnf.com.cn
http://buttress.sxnf.com.cn
http://beguiler.sxnf.com.cn
http://cannibalism.sxnf.com.cn
http://barque.sxnf.com.cn
http://broadcaster.sxnf.com.cn
http://adown.sxnf.com.cn
http://anatole.sxnf.com.cn
http://abby.sxnf.com.cn
http://aglaia.sxnf.com.cn
http://aor.sxnf.com.cn
http://catechumen.sxnf.com.cn
http://badger.sxnf.com.cn
http://biaxial.sxnf.com.cn
http://chlorid.sxnf.com.cn
http://anglicism.sxnf.com.cn
http://azonic.sxnf.com.cn
http://ahithophel.sxnf.com.cn
http://altiplano.sxnf.com.cn
http://betta.sxnf.com.cn
http://berime.sxnf.com.cn
http://castroism.sxnf.com.cn
http://alga.sxnf.com.cn
http://aglisten.sxnf.com.cn
http://aspartame.sxnf.com.cn
http://www.dtcms.com/a/280223.html

相关文章:

  • AR眼镜颠覆医疗:精准手术零误差
  • HTML--教程
  • K-12教育创业新蓝图:告别“刷题”,拥抱“千人千面”个性化学习
  • 物联网设备管理工具实战:用AR运维镜击穿6.8天修复魔咒
  • Bootstrap-HTML(七)Bootstrap在线图标的引用方法
  • 【zynq7020】PS的“Hello World”
  • RHCE认证-Linux 运维知识整合:从基础到进阶的学习路径
  • ESP32S3+VSCode+PlatformIO+Arduino+Freertos开发入门指南:基于Arduino框架的应用开发全流程
  • 多维视角下的可组合性:PTBs 与 EIP-7702 的对比与解析
  • 简单明了的对比PyTorch与TensorFlow
  • 操作系统笔记:进程调度(Process Scheduling)
  • 硬件与软件的桥梁:冯诺依曼体系、操作系统和初始进程的深度解析
  • 排序算法实战(上)
  • 串口通信性能优化
  • 人形机器人:技术落地、场景适配与产业演进
  • 卫星通信链路预算之六:输出回退
  • [RPA] 多页订单的自动处理
  • 高并发四种IO模型的底层原理
  • 【Rust Web】Axum :构建高性能 Web 服务
  • 快速精准估算光伏电站造价:效率与精度的关键
  • 4.增-demo
  • Java全栈工程师面试实录:从电商支付到AI大模型的应用场景与技术栈解析
  • 50天50个小项目 (Vue3 + Tailwindcss V4) ✨ | DoubleClickHeart(双击爱心)
  • [INS-30014]无法检查指定的位置是否在CFS上
  • 【PTA数据结构 | C语言版】根据层序序列重构二叉树
  • 陶瓷基复合材料烧结:工业软件国有化在孔隙率控制仿真中的替代
  • [设计模式]C++单例模式的几种写法以及通用模板
  • HTTP请求
  • 医疗数据分析中标准化的作用
  • sglang笔记1: 后端详细阅读版