doc: updated doc

This commit is contained in:
victor
2022-12-23 17:25:45 +04:00
parent 64d629133c
commit 6580c65be3
6 changed files with 71 additions and 12 deletions

View File

@@ -44,6 +44,7 @@ function getComponents() {
{ text: 'Card', link: 'components/card.md' }, { text: 'Card', link: 'components/card.md' },
{ text: 'Carousel', link: 'components/carousel' }, { text: 'Carousel', link: 'components/carousel' },
{ text: 'Dropdown', link: '/components/dropdown' }, { text: 'Dropdown', link: '/components/dropdown' },
{ text: 'Pagination', link: 'components/pagination' },
{ text: 'Progress', link: 'components/progress' }, { text: 'Progress', link: 'components/progress' },
{ text: 'Rating', link: 'components/rating' }, { text: 'Rating', link: 'components/rating' },
{ text: 'Spinner', link: '/components/spinner' }, { text: 'Spinner', link: '/components/spinner' },
@@ -57,7 +58,6 @@ function getComponents() {
{ text: 'Navbar', link: 'components/navbar' }, { text: 'Navbar', link: 'components/navbar' },
{ text: '- Footer', link: 'components/footer' }, { text: '- Footer', link: 'components/footer' },
{ text: '- Pagination', link: 'components/pagination' },
{ text: '- Sidebar', link: 'components/sidebar' }, { text: '- Sidebar', link: 'components/sidebar' },
] ]
} }

View File

@@ -4,6 +4,7 @@ import PaginationNavigationExample from './pagination/examples/PaginationNavigat
import PaginationTableExample from './pagination/examples/PaginationTableExample.vue'; import PaginationTableExample from './pagination/examples/PaginationTableExample.vue';
import PaginationWithIconsExample from './pagination/examples/PaginationWithIconsExample.vue'; import PaginationWithIconsExample from './pagination/examples/PaginationWithIconsExample.vue';
import PaginationWithCustomTextExample from './pagination/examples/PaginationWithCustomTextExample.vue'; import PaginationWithCustomTextExample from './pagination/examples/PaginationWithCustomTextExample.vue';
import PaginationWithCustomSlice from './pagination/examples/PaginationWithCustomSlice.vue';
</script> </script>
# Vue Pagination Component - Flowbite # Vue Pagination Component - Flowbite
@@ -12,60 +13,107 @@ import PaginationWithCustomTextExample from './pagination/examples/PaginationWit
```vue ```vue
<script setup> <script setup>
import { Pagination } from 'flowbite-vue' import { Pagination } from 'flowbite-vue'
import { ref } from 'vue'
const currentPage = ref(1)
</script> </script>
<template> <template>
<Pagination></Pagination> <Pagination v-model="currentPage" :total-pages="100"></Pagination>
</template>
```
<PaginationExample />
## Default with custom length
You can use your own pages count in the row by passing props: `slice-length`
This prop means left side and right side pages row slicing. In the example it has value `4`. So row length will be 4 + 1 + 4 pages - 9 pages.
```vue
<script setup>
import { Pagination } from 'flowbite-vue'
import { ref } from 'vue'
const currentPage = ref(1)
</script>
<template>
<Pagination v-model="currentPage" :total-pages="100" :slice-length="4"></Pagination>
</template> </template>
``` ```
<PaginationExample /> <PaginationWithCustomSlice />
## Pagination with navigation layout ## Pagination with navigation layout
```vue ```vue
<script setup> <script setup>
import { Pagination } from 'flowbite-vue' import { Pagination } from 'flowbite-vue'
import { ref } from 'vue'
const currentPage = ref(1)
</script> </script>
<template> <template>
<Pagination layout="navigation"></Pagination> <div class="flex items-center justify-center text-center">
<Pagination v-model="currentPage" :total-pages="100" :layout="'navigation'"></Pagination>
</div>
</template> </template>
``` ```
<PaginationNavigationExample /> <PaginationNavigationExample />
## Pagination with table layout ## Pagination with table layout
To use that layout you have to pass required props:
- `per-page`: it's items count displayed on each page.
- `total-items`: it's the total items count.
And there you don't need to use `total-pages` prop.
```vue ```vue
<script setup> <script setup>
import { Pagination } from 'flowbite-vue' import { Pagination } from 'flowbite-vue'
import { ref } from 'vue'
const currentPage = ref(1)
</script> </script>
<template> <template>
<Pagination layout="table"></Pagination> <div class="flex items-center justify-center text-center">
<Pagination
v-model="currentPage"
:layout="'table'"
:per-page="10"
:total-items="998"
></Pagination>
</div>
</template> </template>
``` ```
<PaginationWithIconsExample /> <PaginationTableExample />
## Pagination with icons ## Pagination with icons
```vue ```vue
<script setup> <script setup>
import { Pagination } from 'flowbite-vue' import { Pagination } from 'flowbite-vue'
import { ref } from 'vue'
const currentPage = ref(1)
</script> </script>
<template> <template>
<Pagination></Pagination> <Pagination v-model="currentPage" :total-pages="100" show-icons></Pagination>
</template> </template>
``` ```
<PaginationWithCustomTextExample /> <PaginationWithIconsExample />
## Pagination with custom labels ## Pagination with custom labels
```vue ```vue
<script setup> <script setup>
import { Pagination } from 'flowbite-vue' import { Pagination } from 'flowbite-vue'
import { ref } from 'vue'
const currentPage = ref(1)
</script> </script>
<template> <template>
<Pagination></Pagination> <Pagination v-model="currentPage" :total-pages="100" previous-label="<<<" next-label=">>>"></Pagination>
</template> </template>
``` ```
<PaginationWithCustomTextExample />

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="vp-raw flex flex-col"> <div class="vp-raw">
<Pagination v-model="currentPage" :total-pages="100"></Pagination> <Pagination v-model="currentPage" :total-pages="100"></Pagination>
</div> </div>
</template> </template>

View File

@@ -2,8 +2,8 @@
<div class="vp-raw flex items-center justify-center text-center"> <div class="vp-raw flex items-center justify-center text-center">
<Pagination <Pagination
v-model="currentPage" v-model="currentPage"
:total-pages="100"
:layout="'table'" :layout="'table'"
:per-page="10"
:total-items="998" :total-items="998"
></Pagination> ></Pagination>
</div> </div>

View File

@@ -0,0 +1,11 @@
<template>
<div class="vp-raw">
<Pagination v-model="currentPage" :total-pages="100" :slice-length="4"></Pagination>
</div>
</template>
<script lang="ts" setup>
import { Pagination } from '../../../../src/index'
import { ref } from 'vue'
const currentPage = ref<number>(1)
</script>

View File

@@ -79,7 +79,7 @@ const props = defineProps({
}, },
sliceLength: { sliceLength: {
type: Number, type: Number,
default: 3, default: 2,
}, },
previousLabel: { previousLabel: {
type: String, type: String,