This commit is contained in:
parent
bb9e3a6448
commit
10e859bd28
|
|
@ -25,7 +25,6 @@ export function CarouselDemo() {
|
||||||
const [current, setCurrent] = React.useState(0);
|
const [current, setCurrent] = React.useState(0);
|
||||||
const [count, setCount] = React.useState(0);
|
const [count, setCount] = React.useState(0);
|
||||||
const totalSlides = imageUrls.length;
|
const totalSlides = imageUrls.length;
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (!api) return;
|
if (!api) return;
|
||||||
|
|
||||||
|
|
@ -54,18 +53,18 @@ export function CarouselDemo() {
|
||||||
{Array.from({ length: totalSlides }).map((_, index) => (
|
{Array.from({ length: totalSlides }).map((_, index) => (
|
||||||
<CarouselItem key={index} className="w-full h-full pl-0">
|
<CarouselItem key={index} className="w-full h-full pl-0">
|
||||||
<div className="p-0 w-full h-full">
|
<div className="p-0 w-full h-full">
|
||||||
<CardContent className="p-0 w-full h-full m-0"> {/* 移除了 aspect-square */}
|
|
||||||
<div
|
<CardContent className="flex aspect-square items-center justify-center p-0 w-full h-full m-0">
|
||||||
|
<div
|
||||||
className="w-full h-full"
|
className="w-full h-full"
|
||||||
style={{
|
style={{
|
||||||
backgroundImage: "url('/public/images/header.png')",
|
backgroundImage: "url('/public/images/header.png')",//背景图片可修改
|
||||||
backgroundSize: 'cover', // 改为 cover 以更好地适应容器
|
backgroundSize: '100% 100%',
|
||||||
backgroundPosition: 'center',
|
|
||||||
backgroundRepeat: 'no-repeat',
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</CarouselItem>
|
</CarouselItem>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import {FireNewsList} from "./FireNewsList";
|
||||||
export function FhywPage() {
|
export function FhywPage() {
|
||||||
return(
|
return(
|
||||||
<div className="relative w-350 h-225 mx-auto overflow-hidden bg-sky-700">
|
<div className="relative w-350 h-225 mx-auto overflow-hidden bg-sky-700">
|
||||||
{/* 轮播背景图 */}
|
{/* 轮播背景图 - 确保有明确尺寸 */}
|
||||||
<div className="absolute top-0 left-0 w-full h-180">
|
<div className="absolute top-0 left-0 w-full h-200">
|
||||||
<CarouselDemo />
|
<CarouselDemo />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue