<template>
    <div>
        <a-pagination class="my-pagination" v-model="pagination.current" :total="pagination.total"
            :showTotal="pagination.showTotal" :showSizeChanger="pagination.showSizeChanger" :defaultPageSize='15'
            :pageSizeOptions='pagination.pageSizeOptions' @showSizeChange="sizeChange" @change="currentChange">
        </a-pagination>
    </div>
</template>

<script>
    // import { myPagination } from '@/mixins/myPagination.js'
    export default {
        props: ['pagination'],
        data() {
            return {

            }
        },
        watch: {
            pagination: {
                handler(newVal, oldVal) {
                    console.log(newVal, 'newVal')
                    // console.log(oldVal,'oldVal')
                    // if (newVal.current !== oldVal.current || newVal.pageSize !== oldVal.pageSize) {
                    //     console.log(newVal, '分页改变了')
                    //     this.$emit('change', newVal)
                    // }
                },
                deep: true
            }
        },
        methods: {
            sizeChange(page, pageSize) {
                console.log(page, pageSize, 'page, pageSize')
                this.pagination.current=page;
                this.pagination.pageSize=pageSize;
                this.$emit('change')
            },
            currentChange(current, size) {
                console.log(current, size, 'current, size')
                this.pagination.current=current;
                this.pagination.pageSize=size;
                this.$emit('change')
            }
        }
    }
</script>

<style scoped lang="less">

</style>