<template>
    <!-- 請求參數 -->
    <div>
        <h5>{{ title }}</h5>
        <el-table :data="tableData" border style="width: 100%">
            <template v-for="(item, index) in columns" :key="index">
                <el-table-column :width="item.width" :label="item.label" :prop="item.prop" align="center"></el-table-column>
            </template>
        </el-table>
    </div>
</template>

<script setup lang="ts" name="MyTable">
import { ColumnProps } from "@/components/ProTable/interface";
export interface ProTableProps {
    columns?: ColumnProps[]; // 列配置项  ==> 必传
    tableData?: any[]; // 静态 table data 数据，若存在则不会使用 requestApi 返回的 data ==> 非必传
    title?: string;
}

// 接受父组件参数，配置默认值
withDefaults(defineProps<ProTableProps>(), {
    columns: () => [],
    tableData: () => [],
    title: ""
});
</script>

<style scoped></style>
