import { scrollAnimation } from '@/util/scroll' import { ElPagination } from 'element-plus' import { defineComponent } from 'vue' import styles from './index.module.less' export default defineComponent({ name: 'pagination', props: { total: { required: true, type: Number }, page: { type: Number, default: 1 }, limit: { type: Number, default: 10 }, pageSizes: { type: Array, default: [5, 10, 20, 30, 50] }, // , jumper layout: { type: String, default: 'total, sizes, prev, pager, next' }, showMuitiple: { type: Number, default: 10 }, hideOnSinglePage: { type: Boolean, default: true }, background: { type: Boolean, default: true }, autoScroll: { type: Boolean, default: true }, hidden: { type: Boolean, default: false }, sync: { type: Boolean, default: false }, saveKey: { type: String, default: '' }, pagination: { type: Function, default: () => {} } }, methods: { handleSizeChange(val: number) { this.$emit('update:page', 1) this.$emit('update:limit', val) this.pagination() if (this.autoScroll) { const currentY = document.documentElement.scrollTop || document.body.scrollTop scrollAnimation(currentY, 0) } }, handleCurrentChange(val: number) { this.$emit('update:page', val) this.$emit('update:limit', this.limit) this.pagination() if (this.autoScroll) { const currentY = document.documentElement.scrollTop || document.body.scrollTop scrollAnimation(currentY, 0) } } }, render() { return (