Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有4张图片。每当我交换它们时,我都希望有一个平滑的动画过渡。我如何在我当前的代码中应用它?
点击这里查看代码
另请查看第二张截图。当没有图像时,我不希望左侧交换选项处于活动状态。但它会交换 1 个额外的时间并停止。我的逻辑有什么问题?
这是屏幕截图
试试下面的代码:
const handleSwipeLeft = () => { if (activeImg < totalImage - 1) { setActiveImage(currActive => currActive + 1) } }
因为长度大于索引。