tmagic-editor/packages/design/src/Pagination.vue
2025-03-31 20:31:29 +08:00

39 lines
924 B
Vue

<template>
<component
class="tmagic-design-pagination"
:is="uiComponent"
v-bind="uiProps"
@size-change="handleSizeChange"
@page-size-change="handleSizeChange"
@current-change="handleCurrentChange"
></component>
</template>
<script setup lang="ts">
import { computed } from 'vue';
import { getDesignConfig } from './config';
import type { PaginationProps } from './types';
defineOptions({
name: 'TMPagination',
});
const props = defineProps<PaginationProps>();
const emit = defineEmits(['size-change', 'current-change']);
const ui = getDesignConfig('components')?.pagination;
const uiComponent = ui?.component || 'el-pagination';
const uiProps = computed<PaginationProps>(() => ui?.props(props) || props);
const handleSizeChange = (...args: any[]) => {
emit('size-change', ...args);
};
const handleCurrentChange = (...args: any[]) => {
emit('current-change', ...args);
};
</script>