index.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <script setup lang="ts">
  2. import { useColumns } from "./columns";
  3. import Empty from "../empty.svg?component";
  4. import { useRenderIcon } from "@/components/ReIcon/src/hooks";
  5. import AddFill from "@iconify-icons/ep/plus";
  6. import Delete from "@iconify-icons/ep/delete";
  7. const { columns, dataList, onAdd, onDel } = useColumns();
  8. </script>
  9. <template>
  10. <div class="flex">
  11. <el-scrollbar height="700px">
  12. <code>
  13. <pre class="w-[700px]"> {{ dataList }}</pre>
  14. </code>
  15. </el-scrollbar>
  16. <pure-table
  17. row-key="id"
  18. align-whole="center"
  19. :header-cell-style="{
  20. background: 'var(--el-fill-color-light)',
  21. color: 'var(--el-text-color-primary)'
  22. }"
  23. :data="dataList"
  24. :columns="columns"
  25. >
  26. <template #empty>
  27. <Empty fill="var(--el-svg-monochrome-grey)" class="m-auto" />
  28. </template>
  29. <template #append>
  30. <el-button
  31. plain
  32. class="w-full my-2"
  33. :icon="useRenderIcon(AddFill)"
  34. @click="onAdd"
  35. >
  36. 添加一行数据
  37. </el-button>
  38. </template>
  39. <template #operation="{ row }">
  40. <el-button
  41. class="reset-margin"
  42. link
  43. type="primary"
  44. :icon="useRenderIcon(Delete)"
  45. @click="onDel(row)"
  46. />
  47. </template>
  48. </pure-table>
  49. </div>
  50. </template>
  51. <style scoped>
  52. :deep(.el-table__inner-wrapper::before) {
  53. height: 0;
  54. }
  55. </style>