Skip to content

Commit c89d19e

Browse files
committed
feat: Carousel support responsive #1230
1 parent b4fe211 commit c89d19e

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

components/carousel/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export const CarouselProps = {
6464
variableWidth: PropTypes.bool,
6565
useCSS: PropTypes.bool,
6666
slickGoTo: PropTypes.number,
67+
responsive: PropTypes.array.def(null),
6768
};
6869

6970
const Carousel = {

components/vc-slick/src/default-props.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const defaultProps = {
3131
pauseOnFocus: PropTypes.bool.def(false),
3232
// hover是否暂停
3333
pauseOnHover: PropTypes.bool.def(true),
34-
responsive: PropTypes.any.def(null),
34+
responsive: PropTypes.array.def(null),
3535
rows: PropTypes.number.def(1),
3636
rtl: PropTypes.bool.def(false),
3737
slide: PropTypes.string.def('div'),

types/carousel.d.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,51 @@
44

55
import { AntdComponent } from './component';
66

7+
export interface Settings {
8+
accessibility?: boolean;
9+
adaptiveHeight?: boolean;
10+
arrows?: boolean;
11+
autoplaySpeed?: number;
12+
autoplay?: boolean;
13+
centerMode?: boolean;
14+
centerPadding?: string;
15+
className?: string;
16+
cssEase?: string;
17+
dotsClass?: string;
18+
dots?: boolean;
19+
draggable?: boolean;
20+
easing?: string;
21+
edgeFriction?: number;
22+
fade?: boolean;
23+
focusOnSelect?: boolean;
24+
infinite?: boolean;
25+
initialSlide?: number;
26+
pauseOnDotsHover?: boolean;
27+
pauseOnFocus?: boolean;
28+
pauseOnHover?: boolean;
29+
responsive?: ResponsiveObject[];
30+
rows?: number;
31+
rtl?: boolean;
32+
slide?: string;
33+
slidesPerRow?: number;
34+
slidesToScroll?: number;
35+
slidesToShow?: number;
36+
speed?: number;
37+
swipeToSlide?: boolean;
38+
swipe?: boolean;
39+
touchMove?: boolean;
40+
touchThreshold?: number;
41+
useCSS?: boolean;
42+
useTransform?: boolean;
43+
variableWidth?: boolean;
44+
vertical?: boolean;
45+
verticalSwiping?: boolean;
46+
waitForAnimate?: boolean;
47+
}
48+
export interface ResponsiveObject {
49+
breakpoint: number;
50+
settings: 'unslick' | Settings;
51+
}
752
export declare class Carousel extends AntdComponent {
853
/**
954
* Callback function called after the current index changes
@@ -52,6 +97,8 @@ export declare class Carousel extends AntdComponent {
5297
*/
5398
vertical: boolean;
5499

100+
responsive: ResponsiveObject[];
101+
55102
/**
56103
* Go to slide index, if dontAnimate=true, it happens without animation
57104
* @param slideNumber slide number to go

0 commit comments

Comments
 (0)