diff --git a/app/components/Carousel.tsx b/app/components/Carousel.tsx index cd314d8..bc6b333 100755 --- a/app/components/Carousel.tsx +++ b/app/components/Carousel.tsx @@ -12,21 +12,13 @@ import { type CarouselApi, } from "@/ui/carousel"; import FireNewsList from "./FireNewsList"; - const imageUrls = [ - "/images/carousel-1.jpg", - "/images/carousel-2.jpg", - "/images/carousel-3.jpg", - "/images/carousel-4.jpg", - "/images/carousel-5.jpg", - "/images/carousel-6.jpg", -]; export function CarouselDemo() { const [api, setApi] = React.useState(); const [current, setCurrent] = React.useState(0); const [count, setCount] = React.useState(0); - const totalSlides = imageUrls.length; + const totalSlides = 6; React.useEffect(() => { if (!api) return; @@ -40,7 +32,7 @@ export function CarouselDemo() { }, [api]); return ( -
+
- - {imageUrls.map((src, index) => ( - + + {Array.from({ length: totalSlides }).map((_, index) => ( +
- - {`Slide + +
+
diff --git a/app/components/header/Header.tsx b/app/components/header/Header.tsx index 1714f94..96d3624 100644 --- a/app/components/header/Header.tsx +++ b/app/components/header/Header.tsx @@ -15,7 +15,7 @@ export function Header(){ return (
{/* 时间显示 只显示日期: "2025/3/15"*/} diff --git a/app/routes/news.tsx b/app/routes/news.tsx index 7a8f095..f24288c 100755 --- a/app/routes/news.tsx +++ b/app/routes/news.tsx @@ -1,4 +1,4 @@ -import { CarouselDemo } from "@/components/Carousel"; + import type { Route } from "./+types/news"; import Integrated from "@/components/news/body/Integrated"; import CultureBgPage from "@/components/news/body/Culturebg"; @@ -6,6 +6,7 @@ import {Header} from "@/components/header/Header"; import {TopNav} from "@/components/header/TopNav"; import NewsList from "@/components/list/NewsList"; import ImageGridSection from "@/components/body/ImageGridSection"; +import { CarouselDemo } from "@/components/Carousel"; export function meta( ) { return [ { title: "New React Router App" }, @@ -19,10 +20,10 @@ export default function Home() {
- + - + {/* */}
);