<template>
  <div class="common-table">
    <el-table :data="tableData"  stripe style="width: 100%">
      <el-table-column
        show-overflow-tooltip
        v-for="item in tableLabel"
        :key="item.prop"
        :label="item.label"
        :width="item.width ? item.width : 125"
        :min-width="item.minWidth"
      >
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row[item.prop] }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" min-width="180">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.row)">编辑</el-button>
          <el-button size="mini" type="danger" @click="handleDelete(scope.row)"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>

   
  </div>
</template>
<script>
/* eslint-disable */
export default {
  name: "CommonTable",
  props: {
    tableData: Array,
    tableLabel: Array,
   
  },
  data() {
    return {
   
    };
  },
  methods: {
    handleEdit(row) {
      
      this.$emit('edit',row)
    },
    handleDelete(row) {
     
      this.$emit('del',row)
    },
  
  },
  mounted(){
    //   console.log("tableData")
    //   console.log(this.tableData)
    //   console.log("tableLabel")
    //   console.log(this.tableLabel)
    //   console.log("config")
    //   console.log(this.config)
  }
};

/* eslint-disable */
</script>
<style lang="less" scoped>
.common-table {
 
  // 小bug 窗口大小有问题
  background-color: #fff;
  position: relative;
  .pager {
    position: absolute;
    bottom: 0;
    right: 20px;
  }
}
</style>


tabledata示例
this.tabledata=[
    {
        "id": "46BeC977-dC5b-bB93-2510-9d4AE8CBFc3e",
        "name": "龚静",
        "addr": "宁夏回族自治区 吴忠市 青铜峡市",
        "age": 41,
        "birth": "2010-03-22",
        "sex": 0,
        "sexLabel": "女"
    }
]

this.tableLabel=
[
    {
        "prop": "name",
        "label": "姓名"
    },
    {
        "prop": "age",
        "label": "年龄"
    },
    {
        "prop": "sexLabel",
        "label": "性别"
    },
    {
        "prop": "birth",
        "label": "出生日期",
        "width": 200
    },
    {
        "prop": "addr",
        "label": "地址",
        "width": 320
    }
]



父组件调用示例如下
 <common-table
      :tableData="tableData"
      :tableLabel="tableLabel"
      :config="config"
      @changePage="getList()"
      @edit="editUser"
      @del="delUser"
    ></common-table>