Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 3e03666

Browse files
committed
fix: ssr unfriendly
1 parent f5ab9b0 commit 3e03666

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

Diff for: src/client/components/Pagination.vue

+24-5
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
11
<template>
2-
<paginate
2+
<component
3+
v-if="comp"
4+
:is="comp"
35
v-model="page"
46
:page-count="$pagination.length"
57
:click-handler="clickCallback"
68
:prev-text="'Prev'"
79
:next-text="'Next'"
810
:container-class="'pagination'"
911
:page-class="'page-item'">
10-
</paginate>
12+
</component>
1113
</template>
1214

1315
<script>
14-
import Paginate from 'vuejs-paginate'
15-
1616
export default {
1717
data() {
1818
return {
1919
page: 0,
20+
comp: null,
2021
}
2122
},
22-
components: { Paginate },
23+
2324
created() {
2425
this.page = this.$pagination.paginationIndex + 1
2526
},
27+
28+
mounted() {
29+
import(/* webpackChunkName: "vuejs-paginate" */ 'vuejs-paginate').then(comp => {
30+
this.comp = comp.default
31+
})
32+
},
33+
2634
methods: {
2735
clickCallback(pageNum) {
2836
const link = this.$pagination.getSpecificPageLink(pageNum - 1)
@@ -59,17 +67,20 @@
5967
background-color: #fff;
6068
border: 1px solid #ddd;
6169
}
70+
6271
.pagination > li:first-child > a,
6372
.pagination > li:first-child > span {
6473
margin-left: 0;
6574
border-top-left-radius: 4px;
6675
border-bottom-left-radius: 4px;
6776
}
77+
6878
.pagination > li:last-child > a,
6979
.pagination > li:last-child > span {
7080
border-top-right-radius: 4px;
7181
border-bottom-right-radius: 4px;
7282
}
83+
7384
.pagination > li > a:hover,
7485
.pagination > li > span:hover,
7586
.pagination > li > a:focus,
@@ -79,6 +90,7 @@
7990
background-color: #eee;
8091
border-color: #ddd;
8192
}
93+
8294
.pagination > .active > a,
8395
.pagination > .active > span,
8496
.pagination > .active > a:hover,
@@ -91,6 +103,7 @@
91103
background-color: $accentColor;
92104
border-color: $accentColor;
93105
}
106+
94107
.pagination > .disabled > span,
95108
.pagination > .disabled > span:hover,
96109
.pagination > .disabled > span:focus,
@@ -102,33 +115,39 @@
102115
background-color: #fff;
103116
border-color: #ddd;
104117
}
118+
105119
.pagination-lg > li > a,
106120
.pagination-lg > li > span {
107121
padding: 10px 16px;
108122
font-size: 18px;
109123
line-height: 1.3333333;
110124
}
125+
111126
.pagination-lg > li:first-child > a,
112127
.pagination-lg > li:first-child > span {
113128
border-top-left-radius: 6px;
114129
border-bottom-left-radius: 6px;
115130
}
131+
116132
.pagination-lg > li:last-child > a,
117133
.pagination-lg > li:last-child > span {
118134
border-top-right-radius: 6px;
119135
border-bottom-right-radius: 6px;
120136
}
137+
121138
.pagination-sm > li > a,
122139
.pagination-sm > li > span {
123140
padding: 5px 10px;
124141
font-size: 12px;
125142
line-height: 1.5;
126143
}
144+
127145
.pagination-sm > li:first-child > a,
128146
.pagination-sm > li:first-child > span {
129147
border-top-left-radius: 3px;
130148
border-bottom-left-radius: 3px;
131149
}
150+
132151
.pagination-sm > li:last-child > a,
133152
.pagination-sm > li:last-child > span {
134153
border-top-right-radius: 3px;

0 commit comments

Comments
 (0)