table.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div>
  3. <div class="text-end">
  4. <v-btn color="primary" :disabled="selected.length ? false : true" variant="tonal" @click="handleInappropriate">不合适</v-btn>
  5. </div>
  6. <v-data-table
  7. v-model="selected"
  8. :items="items"
  9. class="mt-3"
  10. :headers="headers"
  11. show-select
  12. item-value="id"
  13. hover
  14. height="60vh"
  15. hide-default-footer
  16. >
  17. <template #bottom></template>
  18. <template v-slot:item.actions>
  19. <v-btn color="primary" variant="text">不合适</v-btn>
  20. </template>
  21. </v-data-table>
  22. <CtPagination
  23. v-if="total > 0"
  24. :total="total"
  25. :page="query.pageNo"
  26. :limit="query.pageSize"
  27. @handleChange="handleChangePage"
  28. ></CtPagination>
  29. </div>
  30. </template>
  31. <script setup>
  32. defineOptions({ name: 'table-page'})
  33. import { ref } from 'vue'
  34. const selected = ref([])
  35. const total = ref(3)
  36. const query = ref({
  37. pageNo: 1,
  38. pageSize: 10
  39. })
  40. const headers = [
  41. { title: '牛人', value: 'name' },
  42. { title: '基本信息', value: 'info' },
  43. { title: '最近工作经历', value: 'work' },
  44. { title: '教育经历', key: 'school', value: item => `${item.startYear}-${item.endYear} ${item.school}` },
  45. { title: '应聘职位', value: 'jobName' },
  46. { title: '操作', value: 'actions' }
  47. ]
  48. const items = [
  49. {
  50. name: '黄桐奕',
  51. info: '本科·21岁·25年应届生·5-8K',
  52. work: 'Java 江门市天天生活科技有限公司',
  53. school: '五邑大学',
  54. jobName: 'Java',
  55. startYear: '2021',
  56. id: 1,
  57. endYear: '2025'
  58. },
  59. {
  60. name: '黄桐奕',
  61. info: '本科·21岁·25年应届生·5-8K',
  62. work: 'Java 江门市天天生活科技有限公司',
  63. school: '五邑大学',
  64. jobName: 'Java',
  65. startYear: '2021',
  66. endYear: '2025',
  67. id: 2
  68. },
  69. {
  70. name: '黄桐奕',
  71. info: '本科·21岁·25年应届生·5-8K',
  72. work: 'Java 江门市天天生活科技有限公司',
  73. school: '五邑大学',
  74. jobName: 'Java',
  75. startYear: '2021',
  76. endYear: '2025',
  77. id: 3
  78. }
  79. ]
  80. const handleChangePage = () => {}
  81. const handleInappropriate = () => {
  82. console.log(selected.value, 'handleInappropriate')
  83. }
  84. </script>
  85. <style scoped lang="scss">
  86. :deep(.v-table > .v-table__wrapper > table > thead) {
  87. background-color: #f7f8fa !important;
  88. }
  89. :deep(.v-selection-control__input) {
  90. color: var(--v-primary-base) !important;
  91. }
  92. </style>