feat: Carousel support responsive #1230

This commit is contained in:
tanjinzhou 2019-09-29 17:22:11 +08:00
parent b4fe21139a
commit c89d19e6e1
3 changed files with 49 additions and 1 deletions

View File

@ -64,6 +64,7 @@ export const CarouselProps = {
variableWidth: PropTypes.bool,
useCSS: PropTypes.bool,
slickGoTo: PropTypes.number,
responsive: PropTypes.array.def(null),
};
const Carousel = {

View File

@ -31,7 +31,7 @@ const defaultProps = {
pauseOnFocus: PropTypes.bool.def(false),
// hover是否暂停
pauseOnHover: PropTypes.bool.def(true),
responsive: PropTypes.any.def(null),
responsive: PropTypes.array.def(null),
rows: PropTypes.number.def(1),
rtl: PropTypes.bool.def(false),
slide: PropTypes.string.def('div'),

47
types/carousel.d.ts vendored
View File

@ -4,6 +4,51 @@
import { AntdComponent } from './component';
export interface Settings {
accessibility?: boolean;
adaptiveHeight?: boolean;
arrows?: boolean;
autoplaySpeed?: number;
autoplay?: boolean;
centerMode?: boolean;
centerPadding?: string;
className?: string;
cssEase?: string;
dotsClass?: string;
dots?: boolean;
draggable?: boolean;
easing?: string;
edgeFriction?: number;
fade?: boolean;
focusOnSelect?: boolean;
infinite?: boolean;
initialSlide?: number;
pauseOnDotsHover?: boolean;
pauseOnFocus?: boolean;
pauseOnHover?: boolean;
responsive?: ResponsiveObject[];
rows?: number;
rtl?: boolean;
slide?: string;
slidesPerRow?: number;
slidesToScroll?: number;
slidesToShow?: number;
speed?: number;
swipeToSlide?: boolean;
swipe?: boolean;
touchMove?: boolean;
touchThreshold?: number;
useCSS?: boolean;
useTransform?: boolean;
variableWidth?: boolean;
vertical?: boolean;
verticalSwiping?: boolean;
waitForAnimate?: boolean;
}
export interface ResponsiveObject {
breakpoint: number;
settings: 'unslick' | Settings;
}
export declare class Carousel extends AntdComponent {
/**
* Callback function called after the current index changes
@ -52,6 +97,8 @@ export declare class Carousel extends AntdComponent {
*/
vertical: boolean;
responsive: ResponsiveObject[];
/**
* Go to slide index, if dontAnimate=true, it happens without animation
* @param slideNumber slide number to go