StripeTable.vue 914 B

1234567891011121314151617181920212223242526272829303132
  1. <script lang="ts" setup>
  2. defineProps({
  3. data: {type: Array, default: []},
  4. columns: {type: Array, default: []},
  5. })
  6. const emit = defineEmits(['click'])
  7. function handleClick(row) {
  8. emit('row-click', row)
  9. }
  10. </script>
  11. <template>
  12. <el-table :data="data" height="100%" stripe @row-click="handleClick" style="font-size: 16px">
  13. <el-table-column v-for="column in columns" :key="column.prop" :label="column.label" :prop="column.prop"
  14. :width="column.width" align="center">
  15. <template v-if="!column.convertFn" #default="scope">
  16. {{ scope.row[column.prop] }}
  17. </template>
  18. <template v-else #default="scope">
  19. <span v-html="column.convertFn(scope.row[column.prop], scope.$index)"></span>
  20. </template>
  21. </el-table-column>
  22. </el-table>
  23. </template>
  24. <style lang="scss" scoped>
  25. .custom-table .cell {
  26. font-size: 16px; /* 你想要的字体大小 */
  27. }
  28. </style>