mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
parent
62611cc6ea
commit
1c8db2a682
@ -470,7 +470,7 @@
|
||||
--Carousel-bg: #f6f8f8;
|
||||
--Carousel-dot-borderRadius: #{px2rem(4px)};
|
||||
--Carousel-dot-height: #{px2rem(8px)};
|
||||
--Carousel-dot-margin: #{px2rem(7px)} var(--gap-xs);
|
||||
--Carousel-dot-margin: #{px2rem(8px)} var(--gap-xs);
|
||||
--Carousel-dot-width: #{px2rem(8px)};
|
||||
--Carousel-height: #{px2rem(200px)};
|
||||
--Carousel-imageDescription-bottom: #{px2rem(25px)};
|
||||
|
@ -149,6 +149,7 @@
|
||||
text-align: center;
|
||||
|
||||
.#{$ns}Carousel-dot {
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
height: var(--Carousel-dot-width);
|
||||
width: var(--Carousel-dot-height);
|
||||
|
@ -278,6 +278,13 @@ export class Carousel extends React.Component<CarouselProps, CarouselState> {
|
||||
clearTimeout(this.durationTimeout as number);
|
||||
}
|
||||
|
||||
@autobind
|
||||
changeSlide(index: number) {
|
||||
this.setState({
|
||||
current: index
|
||||
});
|
||||
}
|
||||
|
||||
renderDots() {
|
||||
const {classnames: cx} = this.props;
|
||||
const {current, options} = this.state;
|
||||
@ -290,6 +297,7 @@ export class Carousel extends React.Component<CarouselProps, CarouselState> {
|
||||
{Array.from({length: options.length}).map((_, i) => (
|
||||
<span
|
||||
key={i}
|
||||
onClick={() => this.changeSlide(i)}
|
||||
className={cx('Carousel-dot', current === i ? 'is-active' : '')}
|
||||
/>
|
||||
))}
|
||||
|
Loading…
Reference in New Issue
Block a user