-
Notifications
You must be signed in to change notification settings - Fork 399
/
VuetablePagination.vue
48 lines (46 loc) · 1.68 KB
/
VuetablePagination.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<template>
<div v-show="tablePagination && tablePagination.last_page > 1" :class="css.wrapperClass">
<a @click="loadPage(1)"
:class="['btn-nav', css.linkClass, isOnFirstPage ? css.disabledClass : '']">
<i v-if="css.icons.first != ''" :class="[css.icons.first]"></i>
<span v-else>«</span>
</a>
<a @click="loadPage('prev')"
:class="['btn-nav', css.linkClass, isOnFirstPage ? css.disabledClass : '']">
<i v-if="css.icons.next != ''" :class="[css.icons.prev]"></i>
<span v-else> ‹</span>
</a>
<template v-if="notEnoughPages">
<template v-for="n in totalPage">
<a @click="loadPage(n)"
:class="[css.pageClass, isCurrentPage(n) ? css.activeClass : '']"
v-html="n">
</a>
</template>
</template>
<template v-else>
<template v-for="n in windowSize">
<a @click="loadPage(windowStart+n-1)"
:class="[css.pageClass, isCurrentPage(windowStart+n-1) ? css.activeClass : '']"
v-html="windowStart+n-1">
</a>
</template>
</template>
<a @click="loadPage('next')"
:class="['btn-nav', css.linkClass, isOnLastPage ? css.disabledClass : '']">
<i v-if="css.icons.next != ''" :class="[css.icons.next]"></i>
<span v-else>› </span>
</a>
<a @click="loadPage(totalPage)"
:class="['btn-nav', css.linkClass, isOnLastPage ? css.disabledClass : '']">
<i v-if="css.icons.last != ''" :class="[css.icons.last]"></i>
<span v-else>»</span>
</a>
</div>
</template>
<script>
import PaginationMixin from './VuetablePaginationMixin.vue'
export default {
mixins: [PaginationMixin],
}
</script>