22 <div class =" pagination" >
33 <span
44 class =" card-box prev iconfont icon-jiantou-zuo"
5- :class =" {disabled: currentPage === 1}"
5+ :class =" { disabled: currentPage === 1 }"
66 @click =" goPrex()"
77 >
88 <p >上一页</p >
99 </span >
1010
1111 <!-- 分页在5页及以下时 -->
12- <div
13- class =" pagination-list"
14- v-if =" pages <= 5"
15- >
12+ <div class =" pagination-list" v-if =" pages <= 5" >
1613 <span
1714 class =" card-box"
1815 v-for =" item in pages"
1916 :key =" item"
20- :class =" {active: currentPage === item}"
17+ :class =" { active: currentPage === item }"
2118 @click =" goIndex(item)"
22- >{{item}}</span >
19+ >{{ item }}</span
20+ >
2321 </div >
2422 <!-- 分页在5页以上 -->
25- <div
26- class =" pagination-list"
27- v-else
28- >
23+ <div class =" pagination-list" v-else >
2924 <!-- 一号位 -->
3025 <span
3126 class =" card-box"
32- :class =" {active: currentPage === 1}"
27+ :class =" { active: currentPage === 1 }"
3328 @click =" goIndex(1)"
34- >1</span >
29+ >1</span
30+ >
3531
3632 <!-- 二号位 -->
3733 <span
4440 <span
4541 class =" card-box"
4642 v-show =" currentPage <= 3"
47- :class =" {active: currentPage === 2}"
43+ :class =" { active: currentPage === 2 }"
4844 @click =" goIndex(2)"
49- >2</span >
45+ >2</span
46+ >
5047
5148 <!-- 三号位 -->
5249 <span
5350 class =" card-box"
54- :class =" {active: currentPage >= 3 && currentPage <= ( pages - 2) }"
51+ :class =" { active: currentPage >= 3 && currentPage <= pages - 2 }"
5552 @click =" goIndex(threeNum())"
56- >{{ threeNum() }}</span >
53+ >{{ threeNum() }}</span
54+ >
5755
5856 <!-- 四号位 -->
5957 <span
6058 class =" ellipsis ell-four"
61- v-show =" currentPage < ( pages - 2) "
59+ v-show =" currentPage < pages - 2"
6260 @click =" goIndex(currentPage + 2)"
6361 title =" 下两页"
6462 />
6563 <span
6664 class =" card-box"
67- v-show =" currentPage >= (pages - 2)"
68- :class =" {active: currentPage === pages-1}"
69- @click =" goIndex(pages-1)"
70- >{{ pages-1 }}</span >
65+ v-show =" currentPage >= pages - 2"
66+ :class =" { active: currentPage === pages - 1 }"
67+ @click =" goIndex(pages - 1)"
68+ >{{ pages - 1 }}</span
69+ >
7170
7271 <!-- 五号位 -->
7372 <span
7473 class =" card-box"
75- :class =" {active: currentPage === pages}"
74+ :class =" { active: currentPage === pages }"
7675 @click =" goIndex(pages)"
77- >{{pages}}</span >
76+ >{{ pages }}</span
77+ >
7878 </div >
7979
8080 <span
8181 class =" card-box next iconfont icon-jiantou-you"
82- :class =" {disabled: currentPage === pages}"
82+ :class =" { disabled: currentPage === pages }"
8383 @click =" goNext()"
8484 >
8585 <p >下一页</p >
@@ -104,12 +104,12 @@ export default {
104104 }
105105 },
106106 computed: {
107- pages () { // 总页数
107+ pages () { // 总页数
108108 return Math .ceil (this .total / this .perPage )
109109 }
110110 },
111111 methods: {
112- threeNum () { // 三号位页码计算
112+ threeNum () { // 三号位页码计算
113113 let num = 3
114114 const currentPage = this .currentPage
115115 const pages = this .pages
@@ -122,24 +122,24 @@ export default {
122122 }
123123 return num
124124 },
125- goPrex () {
125+ goPrex () {
126126 let currentPage = this .currentPage
127127 if (currentPage > 1 ) {
128128 this .handleEmit (-- currentPage)
129129 }
130130 },
131- goNext () {
131+ goNext () {
132132 let currentPage = this .currentPage
133133 if (currentPage < this .pages ) {
134134 this .handleEmit (++ currentPage)
135135 }
136136 },
137- goIndex (i ) {
137+ goIndex (i ) {
138138 if (i !== this .currentPage ) {
139139 this .handleEmit (i)
140140 }
141141 },
142- handleEmit (i ) {
142+ handleEmit (i ) {
143143 this .$emit (' getCurrentPage' , i)
144144 }
145145 }
@@ -151,6 +151,9 @@ export default {
151151 position relative
152152 height 60px
153153 text-align center
154+ @media (max-width 720px )
155+ margin-left 1px
156+ margin-right 1px
154157 span
155158 line-height 1rem
156159 opacity 0.9
@@ -176,16 +179,20 @@ export default {
176179 top 0
177180 padding 1rem 1.2rem
178181 font-size 0.95rem
182+ & ::before
183+ font-size 0.4rem
179184 & .disabled
180185 color rgba (125 , 125 , 125 , 0.5 )
181186 & .prev
182187 left 0
183- border-top-right-radius 32px
184- border-bottom-right-radius 32px
188+ // border-top-right-radius 32px
189+ // border-bottom-right-radius 32px
190+ & ::before
191+ margin-right 0.3rem
185192 & .next
186193 right 0
187- border-top-left-radius 32px
188- border-bottom-left-radius 32px
194+ // border-top-left-radius 32px
195+ // border-bottom-left-radius 32px
189196 & ::before
190197 float right
191198 margin-left 0.3rem
0 commit comments