Update readme
This commit is contained in:
30
README.md
30
README.md
@@ -138,3 +138,33 @@ Slot props:
|
|||||||
<!-- -->
|
<!-- -->
|
||||||
</Carousel>
|
</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>
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user