Skip to content

Commit

Permalink
Expose slick methods (ant-design#7759)
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck authored and afc163 committed Oct 10, 2017
1 parent 91fc781 commit 9f0091d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/carousel/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ A carousel component. Scales with its container.
| beforeChange | Callback function called before the current index changes | function(from, to) | - |
| afterChange | Callback function called after the current index changes | function(current) | - |

## Methods

| Name | Description |
|------|-------------|
| next() | Change current slide to next slide |
| prev() | Change current slide to previous slide |
| goTo(slideNumber) | Change current slide to given slide number |

For more info on the parameters, refer to the https://github.com/akiran/react-slick
12 changes: 12 additions & 0 deletions components/carousel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ export default class Carousel extends React.Component<CarouselProps, any> {
this.slick = node;
}

next() {
this.slick.slickNext();
}

prev() {
this.slick.slickPrev();
}

goTo(slide) {
this.slick.slickGoTo(slide);
}

render() {
let props = {
...this.props,
Expand Down
8 changes: 8 additions & 0 deletions components/carousel/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,12 @@ subtitle: 走马灯
| beforeChange | 切换面板的回调 | function(from, to) ||
| afterChange | 切换面板的回调 | function(current) ||

## 方法

| 名称 | 描述 |
|------|-------------|
| next() | 切换到下一面板 |
| prev() | 切换到上一面板 |
| goTo(slideNumber) | 切换到指定面板 |

更多参数可参考:https://github.com/akiran/react-slick

0 comments on commit 9f0091d

Please sign in to comment.