pagesIndex.vue 707 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <el-row class="pages">
  3. <el-pagination background layout="prev, pager, next" :total="total" :page-size="limit" @change="toChange" />
  4. </el-row>
  5. </template>
  6. <script setup lang="ts">
  7. import { defineEmits } from 'vue'
  8. const total = defineModel('total', {
  9. type: Number,
  10. default: 0
  11. })
  12. const limit = defineModel('limit', {
  13. type: Number,
  14. default: 10
  15. })
  16. const emit = defineEmits(['search'])
  17. /* 点击 */
  18. const toChange = (currentPage: number) => {
  19. emit('search', { skip: (currentPage - 1) * limit.value })
  20. }
  21. </script>
  22. <style scoped lang="scss">
  23. .pages {
  24. display: flex;
  25. justify-content: center;
  26. margin: 30px 0 0 0;
  27. }
  28. </style>