CusPage.vue 872 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <template>
  2. <el-pagination
  3. :current-page="pageNum"
  4. :page-size="pageSize"
  5. :page-sizes="pageSizes"
  6. layout="total, sizes, prev, pager, next, jumper"
  7. :total="total"
  8. size="small"
  9. @size-change="handleSizeChange"
  10. @current-change="handleCurrentChange"
  11. />
  12. </template>
  13. <script setup lang="ts">
  14. defineOptions({
  15. name: 'CusPage',
  16. });
  17. import {getCurrentInstance, reactive} from "vue";
  18. const {proxy} = getCurrentInstance()
  19. const emit = defineEmits(['page'])
  20. const props = defineProps({
  21. pageNum: {required: true},
  22. pageSize: {required: true},
  23. total: {required: true},
  24. pageSizes: {default: () => [10, 20, 30, 40, 50, 100]}
  25. })
  26. const state: any = reactive({})
  27. const handleSizeChange = (val) => {
  28. emit('page', 1, val)
  29. }
  30. const handleCurrentChange = (val) => {
  31. emit('page', val, props.pageSize)
  32. }
  33. </script>
  34. <style lang="scss" scoped>
  35. </style>