Update readme
This commit is contained in:
30
README.md
30
README.md
@@ -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>
|
||||
```
|
||||
Reference in New Issue
Block a user