|
1 | 1 | <template>
|
2 |
| - <paginate |
| 2 | + <component |
| 3 | + v-if="comp" |
| 4 | + :is="comp" |
3 | 5 | v-model="page"
|
4 | 6 | :page-count="$pagination.length"
|
5 | 7 | :click-handler="clickCallback"
|
6 | 8 | :prev-text="'Prev'"
|
7 | 9 | :next-text="'Next'"
|
8 | 10 | :container-class="'pagination'"
|
9 | 11 | :page-class="'page-item'">
|
10 |
| - </paginate> |
| 12 | + </component> |
11 | 13 | </template>
|
12 | 14 |
|
13 | 15 | <script>
|
14 |
| - import Paginate from 'vuejs-paginate' |
15 |
| -
|
16 | 16 | export default {
|
17 | 17 | data() {
|
18 | 18 | return {
|
19 | 19 | page: 0,
|
| 20 | + comp: null, |
20 | 21 | }
|
21 | 22 | },
|
22 |
| - components: { Paginate }, |
| 23 | + |
23 | 24 | created() {
|
24 | 25 | this.page = this.$pagination.paginationIndex + 1
|
25 | 26 | },
|
| 27 | + |
| 28 | + mounted() { |
| 29 | + import(/* webpackChunkName: "vuejs-paginate" */ 'vuejs-paginate').then(comp => { |
| 30 | + this.comp = comp.default |
| 31 | + }) |
| 32 | + }, |
| 33 | + |
26 | 34 | methods: {
|
27 | 35 | clickCallback(pageNum) {
|
28 | 36 | const link = this.$pagination.getSpecificPageLink(pageNum - 1)
|
|
59 | 67 | background-color: #fff;
|
60 | 68 | border: 1px solid #ddd;
|
61 | 69 | }
|
| 70 | + |
62 | 71 | .pagination > li:first-child > a,
|
63 | 72 | .pagination > li:first-child > span {
|
64 | 73 | margin-left: 0;
|
65 | 74 | border-top-left-radius: 4px;
|
66 | 75 | border-bottom-left-radius: 4px;
|
67 | 76 | }
|
| 77 | + |
68 | 78 | .pagination > li:last-child > a,
|
69 | 79 | .pagination > li:last-child > span {
|
70 | 80 | border-top-right-radius: 4px;
|
71 | 81 | border-bottom-right-radius: 4px;
|
72 | 82 | }
|
| 83 | + |
73 | 84 | .pagination > li > a:hover,
|
74 | 85 | .pagination > li > span:hover,
|
75 | 86 | .pagination > li > a:focus,
|
|
79 | 90 | background-color: #eee;
|
80 | 91 | border-color: #ddd;
|
81 | 92 | }
|
| 93 | + |
82 | 94 | .pagination > .active > a,
|
83 | 95 | .pagination > .active > span,
|
84 | 96 | .pagination > .active > a:hover,
|
|
91 | 103 | background-color: $accentColor;
|
92 | 104 | border-color: $accentColor;
|
93 | 105 | }
|
| 106 | + |
94 | 107 | .pagination > .disabled > span,
|
95 | 108 | .pagination > .disabled > span:hover,
|
96 | 109 | .pagination > .disabled > span:focus,
|
|
102 | 115 | background-color: #fff;
|
103 | 116 | border-color: #ddd;
|
104 | 117 | }
|
| 118 | + |
105 | 119 | .pagination-lg > li > a,
|
106 | 120 | .pagination-lg > li > span {
|
107 | 121 | padding: 10px 16px;
|
108 | 122 | font-size: 18px;
|
109 | 123 | line-height: 1.3333333;
|
110 | 124 | }
|
| 125 | + |
111 | 126 | .pagination-lg > li:first-child > a,
|
112 | 127 | .pagination-lg > li:first-child > span {
|
113 | 128 | border-top-left-radius: 6px;
|
114 | 129 | border-bottom-left-radius: 6px;
|
115 | 130 | }
|
| 131 | + |
116 | 132 | .pagination-lg > li:last-child > a,
|
117 | 133 | .pagination-lg > li:last-child > span {
|
118 | 134 | border-top-right-radius: 6px;
|
119 | 135 | border-bottom-right-radius: 6px;
|
120 | 136 | }
|
| 137 | + |
121 | 138 | .pagination-sm > li > a,
|
122 | 139 | .pagination-sm > li > span {
|
123 | 140 | padding: 5px 10px;
|
124 | 141 | font-size: 12px;
|
125 | 142 | line-height: 1.5;
|
126 | 143 | }
|
| 144 | + |
127 | 145 | .pagination-sm > li:first-child > a,
|
128 | 146 | .pagination-sm > li:first-child > span {
|
129 | 147 | border-top-left-radius: 3px;
|
130 | 148 | border-bottom-left-radius: 3px;
|
131 | 149 | }
|
| 150 | + |
132 | 151 | .pagination-sm > li:last-child > a,
|
133 | 152 | .pagination-sm > li:last-child > span {
|
134 | 153 | border-top-right-radius: 3px;
|
|
0 commit comments