fixColumn.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <script setup lang="ts">
  2. import { tableDataMore } from "./data";
  3. withDefaults(
  4. defineProps<{
  5. height?: string;
  6. }>(),
  7. {
  8. height: null
  9. }
  10. );
  11. const columns: TableColumnList = [
  12. {
  13. label: "日期",
  14. prop: "date",
  15. width: "260",
  16. fixed: true
  17. },
  18. {
  19. label: "姓名",
  20. prop: "name",
  21. width: "260"
  22. },
  23. {
  24. label: "地区",
  25. prop: "state",
  26. width: "260"
  27. },
  28. {
  29. label: "城市",
  30. prop: "city",
  31. width: "260"
  32. },
  33. {
  34. label: "地址",
  35. prop: "address",
  36. width: "260"
  37. },
  38. {
  39. label: "邮编",
  40. prop: "post-code",
  41. width: "260"
  42. },
  43. {
  44. label: "操作",
  45. width: "120",
  46. fixed: "right",
  47. slot: "operation"
  48. }
  49. ];
  50. function handleClick(row) {
  51. console.log(
  52. "%crow===>>>: ",
  53. "color: MidnightBlue; background: Aquamarine; font-size: 20px;",
  54. row
  55. );
  56. }
  57. </script>
  58. <template>
  59. <pure-table
  60. :data="
  61. height
  62. ? tableDataMore.concat(tableDataMore).concat(tableDataMore)
  63. : tableDataMore
  64. "
  65. :columns="columns"
  66. :height="height"
  67. >
  68. <template #operation="{ row }">
  69. <el-button link type="primary" size="small" @click="handleClick(row)">
  70. Detail
  71. </el-button>
  72. <el-button link type="primary" size="small">Edit</el-button>
  73. </template>
  74. </pure-table>
  75. </template>