<template>
  <div class="myTableHeader_container">
    <!-- <div class="header-title">{{ title }}</div> -->
    <div class="tabs">
      <span
        :class="{ 'list-tab': true, 'list-tab-active': tab.active }"
        v-for="tab in tabs"
        :key="tab.label"
        @click="tabChange(tab)"
        >{{ tab.label }}</span
      >

      <!-- <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
        <el-tab-pane :label="tab.label" :name="tab.name"   v-for="(tab, index) in tabs"
        :key="index"></el-tab-pane>
      </el-tabs> -->
    </div>
    <div class="buttons">
      <el-button
        size="mini"
        type="primary"
        v-for="(button, index) in buttons"
        :key="index"
        :type="button.type"
        :icon="button.icon"
        @click="handleButtonClick(button.methodName)"
      >
        {{ button.label }}</el-button
      >
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: String,
    buttons: {
      type: Array,
     default: () => []
    },
    tabs: {
      type: Array,
      default: () => []
    },
  },
  data() {
    return {};
  },
  mounted() {},
  methods: {
    // 点击按钮时触发的方法
    handleButtonClick (methodName) {
      console.log(methodName,'methodName99')
      this.$emit("buttonClick", methodName);
    },
    // tab 切换
    tabChange(tab, event) {
      this.$emit("tabClick", tab);
    },
  },
};
</script>

<style scoped lang="scss">
.myTableHeader_container {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title {
  font-size: 20px;
}

.tabs {
  display: flex;
  align-items: end;
  background-color: #fff;
  .list-tab {
    width: 160px;
    height: 40px;
    border: 1px solid #e7e7e7;
    color: #000;
    line-height: 40px;
    text-align: center;
    font-size: 16px;
  }
  .list-tab-active {
    width: 160px;
    height: 40px;
    color: #fff;
    border: 1px solid #1890ff;
    background-color: #1890ff;
  }
}
/* .form-actions {
  margin-top: 20px;
} */
</style>
