Update readme

This commit is contained in:
Vadim
2021-06-29 11:19:35 +03:00
parent e15c162e42
commit f2cf47b8d4

View File

@@ -137,4 +137,34 @@ Slot props:
</div>
<!-- -->
</Carousel>
```
## Methods
### `goTo`
Navigates to a page by index
Arguments:
| Prop | Type | Default | Description |
|--------------------|-------------|---------|---------------------------------------|
| `pageIndex` | `number` | | Page number |
| `options.animated` | `boolean` | `true` | Should be animated or not |
```jsx
<script>
// ...
let carousel;
function goToStartPage() {
carousel.goTo(0, { animated: false })
}
</script>
<Carousel
bind:this={carousel}
>
<!-- -->
</Carousel>
<button class="button" on:click={goToStartPage}>Go</button>
```