<template>
  <el-table :data="tableData" style="width: 100%">
    <el-table-column prop="id" label="用户ID" width="180"></el-table-column>
    <el-table-column prop="userAccount" label="用户账号" width="180"></el-table-column>
    <el-table-column prop="userName" label="用户名称"></el-table-column>
    <el-table-column prop="userAvatar" label="用户头像"></el-table-column>
    <el-table-column prop="userRole" label="用户角色"></el-table-column>
    <el-table-column prop="createTime" label="创建时间"></el-table-column>
    <el-table-column prop="updateTime" label="更新时间"></el-table-column>
    <el-table-column label="操作">
      <template #default="scope">
        <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
        <el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
export default {
  data() {
    return {
      // tableData: []
    };
  },
  props:["tableData"],
  methods: {
    handleEdit(index, row) {
      this.$emit('edit', row);
    },
    handleDelete(index, row) {
      this.$emit('delete', row);
    }
  },
  computed:{
    tableData() {
      return this.tableData;
    }
  },
  updated() {
    console.log(this.tableData);
  }
};
</script>
