tj
2025-06-05 bba272999cc546f65781bf3d20245a3f819af67f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<template>
  <div>
    <el-table :data="rowData" v-if="columns.length > 0">
      <!-- 动态生成表格列 -->
      <el-table-column v-for="column in columns" :key="column.prop" :prop="column.prop" :label="column.label">
      </el-table-column>
    </el-table>
    <div v-else>
      表格数据为空
    </div>
  </div>
</template>
 
<script>
import { ref } from 'vue';
 
export default {
  props: {
    columns: {
      type: Array,
      required: true,
    },
    rows: {
      type: Array,
      required: true,
    },
  },
  setup(props) {
    const rowData = ref(props.rows);
 
    return {
      rowData,
    };
  },
};
</script>
 
<style>
/* 样式可以根据需要进行调整 */
</style>