layout-table.vue 916 Bytes
<template>
  <div class="layout-table">
    <slot></slot>
    <div class="footer">
      <div class="footer-left">
        <slot name="footer"></slot>
      </div>
      <div class="footer-right">
        <i-page
          :current="current"
          :total="total"
          :page-size="pageSize"
          @on-change="onChange"></i-page>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'LayoutTable',
  props: {
    total: Number,
  },
  data() {
    return {
      current: 1,
      pageSize: 10
    };
  },
  methods: {
    onChange(page) {
      this.current = page;
      this.$emit('on-page-change', page);
    }
  }
}
</script>

<style lang="scss" scoped>
.layout-table {
  padding: 10px 0;

  .footer {
    width: 100%;
    display: flex;
    padding: 10px 0;
  }

  .footer-left {
    flex: 1;
  }

  .footer-right {
    width: 500px;
    text-align: right;
  }
}
</style>