Update docs

This commit is contained in:
Vadim
2021-06-29 11:29:20 +03:00
parent f2cf47b8d4
commit d12fc14fdf
2 changed files with 47 additions and 4 deletions

View File

@@ -146,15 +146,14 @@ Navigates to a page by index
Arguments: Arguments:
| Prop | Type | Default | Description | | Argument | Type | Default | Description |
|--------------------|-------------|---------|---------------------------------------| |--------------------|-------------|---------|---------------------------------------|
| `pageIndex` | `number` | | Page number | | `pageIndex` | `number` | | Page number |
| `options.animated` | `boolean` | `true` | Should be animated or not | | `options.animated` | `boolean` | `true` | Should it be animated or not |
```jsx ```jsx
<script> <script>
// ... // ...
let carousel; let carousel;
function goToStartPage() { function goToStartPage() {
carousel.goTo(0, { animated: false }) carousel.goTo(0, { animated: false })

View File

@@ -186,6 +186,8 @@
## Use case ## Use case
<AlbumsPreview /> <AlbumsPreview />
<Divider />
# Installation # Installation
```bash ```bash
yarn add svelte-carousel yarn add svelte-carousel
@@ -202,7 +204,10 @@ Import component
</script> </script>
``` ```
<Divider />
# Props # Props
<div class="table-wrapper"> <div class="table-wrapper">
| Prop | Type | Default | Description | | Prop | Type | Default | Description |
@@ -220,7 +225,9 @@ Import component
</div> </div>
# Event <Divider />
# Events
## `pageChange` ## `pageChange`
Is dispatched on page change Is dispatched on page change
@@ -243,6 +250,8 @@ Is dispatched on page change
</Carousel> </Carousel>
``` ```
<Divider />
# Slots # Slots
## `prev` and `next` ## `prev` and `next`
@@ -329,6 +338,41 @@ Slot props:
<Divider /> <Divider />
# Methods
## `goTo`
Navigates to a page by index
Arguments:
<div class="table-wrapper">
| Argument | Type | Default | Description |
|--------------------|-------------|---------|---------------------------------------|
| `pageIndex` | `number` | | Page number |
| `options.animated` | `boolean` | `true` | Should it be animated or not |
</div>
```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>
```
<Divider />
<style> <style>
.img-container { .img-container {
display: block; display: block;