<template>
  <div class="table_template">
    <table class="table">
      <thead>
        <tr>
          <td>No.</td>
          <td>DLR Code</td>
          <td>经销商范围</td>
          <td>所属区域</td>
        </tr>
      </thead>
      <tbody>
        <tr
          v-for="(obj, index) in tableData"
          :key="index"
          :class="{ table_gray: index % 2 === 0 }"
        >
          <td style="width: 7%">{{ pageSize * (currentPage-1) + index + 1 }}</td>
          <td style="width: 18%">{{ obj.dlrCode }}</td>
          <td style="width: 60%">{{ obj.dlrName }}</td>
          <td style="width: 15%">{{ obj.localArea }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script>
export default {
  props: {
    // 表数据
    tableData: {
      type: Array,
      default: () => {
        return [];
      },
    },
    pageSize: {
      type: Number,
      default: 20
    },
    currentPage: {
      type: Number,
      default: 1
    },
  },
  mounted() {
  },
  data() {
    return {};
  },
};
</script>

<style scoped lang="less">
.table_template {
  text-align: center;
  max-height: 300px;
  overflow: auto;
  .table {
    background-color: #fff;
    border-collapse: collapse;
    border: none;
    width: 100%;
    overflow: auto;
    td {
      border: 1px solid #ccc;
      height: 29px;
    }
    thead {
      td {
        background-color: #8d9092;
        color: #fff;
      }
    }
  }
}
.table_gray {
  background: #f5f5f5;
}
</style>
