pageSelect.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <div class="content">
  3. <div class="conBox page-select">
  4. <!-- 当前页数-->
  5. <!-- 总页数-->
  6. <div :class="`p-btn prev ${page===1?'disable-btn':''}`"
  7. @click="prevPageHandle">
  8. <svg-icon icon-class="prev"/>
  9. </div>
  10. <div class="p-show">
  11. {{page}}/{{total}}
  12. 页 {{count}}条
  13. </div>
  14. <div :class="`p-btn next ${page===total?'disable-btn':''}`"
  15. @click="nextPageHandle">
  16. <svg-icon icon-class="next"/>
  17. </div>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. export default {
  23. name: "pageSelect",
  24. props:{
  25. page: {default:1},
  26. count: {default:1},
  27. total: {default:1}
  28. },
  29. methods:{
  30. prevPageHandle(){
  31. if(this.page <= 1){
  32. return
  33. }
  34. this.$root.$emit('changePage',this.page-1);
  35. },
  36. nextPageHandle(){
  37. if(this.page >= this.total){
  38. return
  39. }
  40. this.$root.$emit('changePage',this.page+1);
  41. }
  42. }
  43. }
  44. </script>
  45. <style scoped>
  46. .page-select{
  47. display: flex;
  48. justify-content: center;
  49. align-items: center;
  50. margin-top: 10px;
  51. margin-bottom: 15px;
  52. }
  53. .p-btn{
  54. width: 120px;
  55. height: 35px;
  56. display: flex;
  57. justify-content: center;
  58. font-size: 1.4rem;
  59. align-items: center;
  60. border-radius: 3px;
  61. box-shadow: 1px 1px 3px blanchedalmond;
  62. background: #4397bd;
  63. cursor: pointer;
  64. }
  65. .disable-btn{
  66. cursor: not-allowed;
  67. background: #595959;
  68. color: white;
  69. }
  70. .p-show{
  71. margin: 0 10px;
  72. }
  73. </style>