File tree Expand file tree Collapse file tree 3 files changed +30
-17
lines changed Expand file tree Collapse file tree 3 files changed +30
-17
lines changed Original file line number Diff line number Diff line change 1111 :show-customize-editor-add-draw =" true"
1212 :show-line-size-select = ' true'
1313 :show-font-size-select = ' true'
14+ :show-pagination =" true"
1415 :show-font-select =" true"
1516 :show-rename =" true"
1617 :show-save-btn =" true"
2425 :seal-image-hidden-on-save =" false"
2526 @onSave2Upload =" save2Upload"
2627 >
28+ <template #pagination =" { pages , currentPage , onPageChange } " >
29+ <ul class =" inline-flex" >
30+ <li @click =" onPageChange(currentPage-1)" >previous</li >
31+ <p >{{ currentPage }}/{{ pages }}</p >
32+ <li @click =" onPageChange(currentPage+1)" >next</li >
33+ </ul >
34+ </template >
2735 </VuePdfEditor >
2836
2937 </div >
@@ -42,6 +50,9 @@ export default {
4250 }
4351 },
4452 methods: {
53+ pageChange (e ){
54+ console .log (e)
55+ },
4556 save2Upload (payload ){
4657 console .log (payload .pdfBytes );
4758 console .log (payload .fileName );
Original file line number Diff line number Diff line change 11<template >
22 <div class =" inline-flex -space-x-px text-sm" >
3- <button :disabled =" !canPreviousPage" class =" flex items-center px-3 h-8 ms-0 leading-tight bg-blue-500 border border-e-0 rounded-s-lg hover:bg-blue-700 text-white font-bold disabled:dark:bg-blue-300" @click =" onPreviousPage" :class =" {'cursor-not-allowed': !canPreviousPage}" >Previous</button >
4- <p class =" flex items-center px-3 h-8 leading-tight text-white bg-blue-500 border border-gray-300 font-bold" >{{ page }} Of {{ pages }}</p >
5- <button :disabled =" !canNextPage" class =" flex items-center px-3 h-8 ms-0 leading-tight bg-blue-500 border border-e-0 rounded-r-lg hover:bg-blue-700 text-white font-bold disabled:dark:bg-blue-300" @click =" onNextPage" :class =" {'cursor-not-allowed': !canNextPage}" >Next</button >
3+ <button :disabled =" !canPreviousPage" class =" flex items-center px-3 h-8 ms-0 leading-tight bg-blue-500 border border-e-0 rounded-s-lg hover:bg-blue-700 text-white font-bold disabled:dark:bg-blue-300" @click =" onPreviousPage" :class =" {'cursor-not-allowed': !canPreviousPage}" >Previous</button >
4+ <p class =" flex items-center px-3 h-8 leading-tight text-white bg-blue-500 border border-gray-300 font-bold" >{{ page }} Of {{ pages }}</p >
5+ <button :disabled =" !canNextPage" class =" flex items-center px-3 h-8 ms-0 leading-tight bg-blue-500 border border-e-0 rounded-r-lg hover:bg-blue-700 text-white font-bold disabled:dark:bg-blue-300" @click =" onNextPage" :class =" {'cursor-not-allowed': !canNextPage}" >Next</button >
66 </div >
77</template >
88
99<script >
1010 export default {
1111 name: ' PaginationComponent' ,
12- data (){
13- return {
14- currentPage: 0 ,
15- }
16- },
1712 computed: {
1813 page (){
1914 return this .currentPage + 1
2621 }
2722 },
2823 updated (){
29- this .$emit (' onPageChange' ,{
30- page: this .currentPage
31- })
24+ this .$emit (' onPageChange' ,this .currentPage )
3225 },
3326 props: {
3427 pages: {
3528 type: Number ,
3629 default: 0 ,
3730 required: true ,
3831 },
32+ currentPage: {
33+ type: Number ,
34+ default: 0 ,
35+ required: true
36+ }
3937 },
4038 methods: {
4139 onPreviousPage (){
42- this .currentPage --
40+ this .$emit ( ' update:current-page ' , this . currentPage - 1 )
4341 },
4442 onNextPage (){
45- this .currentPage ++
43+ this .$emit ( ' update:current-page ' , this . currentPage + 1 )
4644 },
4745 }
4846 }
Original file line number Diff line number Diff line change 7878 {{ saving ? 'saving' : 'keep' }}
7979 </button >
8080
81- < div v-if =" pages.length" class =" flex items-center gap-4" >
82- <Pagination :pages =" pages.length" @onPageChange =" onPageChange" />
83- </ div >
81+ < slot name = " pagination " v-if =" pages.length && showPagination " class =" flex items-center gap-4" :pages = " pages.length " :current-page = " currentPage " :onPageChange = " onPageChange " >
82+ <Pagination :pages =" pages.length" :current-page.sync = " currentPage " @onPageChange =" onPageChange" />
83+ </ slot >
8484
8585 </div >
8686 <div v-if =" addingDrawing" >
@@ -232,6 +232,10 @@ export default {
232232 type: String ,
233233 default: ' 100%' ,
234234 },
235+ showPagination: {
236+ type: Boolean ,
237+ default: false
238+ },
235239 showChooseFileBtn: {
236240 type: Boolean ,
237241 default: false ,
@@ -682,7 +686,7 @@ export default {
682686 this .saving = false
683687 }
684688 },
685- onPageChange ({ page } ){
689+ onPageChange (page ){
686690 this .currentPage = page
687691 }
688692 }
You can’t perform that action at this time.
0 commit comments