Browse Source

fix: 修复 Carousel 组件 left/right 模式下卡片轮播方向 (#20781)

* fix: 修复 Carousel 组件 left/right 模式下卡片轮播方向

* fix: snap

* add: test

* remove: unnecessary code
pull/20790/head
xrkffgg 5 years ago
committed by 偏右
parent
commit
0800063f34
  1. 4
      components/carousel/__tests__/__snapshots__/index.test.js.snap
  2. 3
      components/carousel/index.tsx

4
components/carousel/__tests__/__snapshots__/index.test.js.snap

@ -58,7 +58,7 @@ exports[`Carousel should works for dotPosition left 1`] = `
class="ant-carousel ant-carousel-vertical"
>
<div
class="slick-slider slick-initialized"
class="slick-slider slick-vertical slick-initialized"
>
<div
class="slick-list"
@ -92,7 +92,7 @@ exports[`Carousel should works for dotPosition right 1`] = `
class="ant-carousel ant-carousel-vertical"
>
<div
class="slick-slider slick-initialized"
class="slick-slider slick-vertical slick-initialized"
>
<div
class="slick-list"

3
components/carousel/index.tsx

@ -105,11 +105,12 @@ export default class Carousel extends React.Component<CarouselProps, {}> {
const prefixCls = getPrefixCls('carousel', props.prefixCls);
const dotsClass = 'slick-dots';
const dotPosition = this.getDotPosition();
props.vertical = dotPosition === 'left' || dotPosition === 'right';
props.dotsClass = `${dotsClass} ${dotsClass}-${dotPosition || 'bottom'}`;
const className = classNames(prefixCls, {
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-vertical`]: dotPosition === 'left' || dotPosition === 'right',
[`${prefixCls}-vertical`]: props.vertical,
});
return (

Loading…
Cancel
Save