【发布时间】:2019-12-17 05:57:36
【问题描述】:
您好,我有一个轮播,但根据我的轮播的大小,我无法将图像 100% 保留
const ImageCarousel = () => (
<CarouselProvider
totalSlides={3}
naturalSlideWidth={1}
naturalSlideHeight={1.25}
dragEnabled={false}
touchEnabled={false}
style={{ height: "500",position: "relative"}}
>
<Slider style={{maxHeight:'500px', width:'100%'}}>
<Slide tag="a" index={0}>
<Image src="https://lorempixel.com/800/800/cats/0" />
</Slide>
<Slide tag="a" index={1}>
<Image src="https://lorempixel.com/800/800/cats/1" />
</Slide>
<Slide tag="a" index={2}>
<Image src="https://lorempixel.com/800/800/cats/2" />
</Slide>
</Slider>
<Container style={{position: 'relative', backgroundColor:'#000'}}>
<ButtonBack style={{position: 'absolute', transform: 'translate(-50%,-50%)', backgroundColor: 'transparent', border: 0}}><Icon fitted name='arrow right' size='big' /></ButtonBack>
<ButtonNext style={{position: 'absolute', transform: 'translate(-50%,-50%)', backgroundColor: 'transparent', border: 0}}><Icon fitted name='arrow left' size='big' /></ButtonNext>
</Container>
</CarouselProvider>
);
现在我有了这个:
【问题讨论】: