import { isBrowser } from '@/lib/utils' import { useEffect, useState } from 'react' /** * 一个swipe组件 * 垂直方向,定时滚动 * @param {*} param0 * @returns */ export function Swipe({ items }) { const [activeIndex, setActiveIndex] = useState(0) const handleClick = (item) => { if (isBrowser) { window.open(item?.url) } } useEffect(() => { const interval = setInterval(() => { setActiveIndex((activeIndex + 1) % items.length) }, 3000) return () => clearInterval(interval) }, [activeIndex, items.length]) return (