CusTableColumn.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <slot :name="`${item?.value}-column`" :column="item">
  3. <el-table-column
  4. :show-overflow-tooltip="!item?.popover"
  5. :label="item?.label"
  6. :prop="item?.value"
  7. :column-key="item?.value"
  8. :sortable="item?.sort ? 'custom' : false"
  9. :width="item?.width ? item.width : 'auto'"
  10. :min-width="item?.minWidth ? item.minWidth : ''"
  11. :align="item?.align ? item.align : 'center'"
  12. :header-align="item?.headerAlign ? item.headerAlign : 'center'"
  13. :fixed="item?.fixed ? item.fixed : false"
  14. :filters="item?.filters ? item.filters : null"
  15. :filter-multiple="!!item?.filterMultiple"
  16. >
  17. <template #default="scope">
  18. <template v-if="item.html">
  19. <div v-html="scope?.row[item?.value]"></div>
  20. </template>
  21. <template v-else>
  22. <slot :name="`${item?.value}-column-value`" :scope="scope">
  23. {{ scope?.row[item?.value] }}
  24. <!-- <CusPopover v-if="item?.popover" :value="scope?.row[item?.value]">-->
  25. <!-- <div class="__text-ellipsis">{{ scope?.row[item?.value] }}</div>-->
  26. <!-- </CusPopover>-->
  27. <!-- <template v-else>-->
  28. <!-- {{ scope?.row[item?.value] }}-->
  29. <!-- </template>-->
  30. </slot>
  31. </template>
  32. </template>
  33. <template #header>
  34. <slot :name="`${item?.value}-header-value`"/>
  35. </template>
  36. </el-table-column>
  37. </slot>
  38. </template>
  39. <script setup lang="ts">
  40. defineOptions({
  41. name: 'CusTableColumn',
  42. });
  43. import {getCurrentInstance, reactive} from "vue";
  44. const {proxy} = getCurrentInstance()
  45. const props = defineProps({
  46. item: {
  47. required: true
  48. },
  49. })
  50. const state: any = reactive({})
  51. const onPage = () => {
  52. }
  53. </script>
  54. <style lang="scss" scoped>
  55. </style>