diff --git a/app/components/AutoCarousel.tsx b/app/components/AutoCarousel.tsx index 6e8d645..971f2fe 100644 --- a/app/components/AutoCarousel.tsx +++ b/app/components/AutoCarousel.tsx @@ -6,7 +6,7 @@ import { Carousel, CarouselContent, CarouselItem, -} from "@/ui/carousel"; // 注意这里也移除了未使用的导入 +} from "@/ui/carousel"; const imageUrls = [ "/images/carousel-1.jpg", @@ -22,7 +22,7 @@ const imageUrls = [ export function AutoCarouselDemo() { return ( -
+
-
+
(); const [current, setCurrent] = React.useState(0); const [count, setCount] = React.useState(0); const totalSlides = imageUrls.length; - const [isDotPagination, setIsDotPagination] = React.useState(true); // 控制分页指示器类型 React.useEffect(() => { if (!api) return; @@ -52,18 +59,16 @@ export function CarouselDemo() { className="w-full h-full" > - {Array.from({ length: totalSlides }).map((_, index) => ( + {imageUrls.map((src, index) => (
- -
-
+ + {`Slide
@@ -73,15 +78,21 @@ export function CarouselDemo() { - {/* 分页指示器 - 右下角 */} -
+ {/* 分页指示器 */} +
{Array.from({ length: count }).map((_, index) => (