<template></template>

<script>
export default {
  props: {
    url: {
      type: Function
    },

    params: {
      type: Object,
      default: () => ({})
    },
    tableData: {
      type: Array,
      default: () => []
    },
    params1: {
      type: Object,
      default: () => ({})
    }
  },
  data () {
    return {
      sizes: [5, 10, 15, 20, 30, 40, 50]
    }
  },
  created () {
    this.initData()
  },
  methods: {
    async initData () {
      if (!this.url) return
      let res = await this.url(this.params, this.params1)
      if (res?.success) {
        this.$emit('update:tableData', res.data.records)
        this.params.total = res.data.total
      }
    },

    handleCurrentChange (e) {
      this.params.page = e
      this.initData()
    },
    handleSizeChange (e) {
      this.params.size = e
      this.initData()
    }
  }
}
</script>

<style lang="scss" scpoed>
.mt10 {
  margin-top: 10px;
}
.right {
  text-align: right;
}
</style>
