当前位置:   article > 正文

vxe-table单元格可编辑(下拉选择数值)_vxetable下拉选项

vxetable下拉选项

 首先在vxe-table标签中开启单元格可编辑配置

  1. <vxe-table
  2. ref="xTable"
  3. border
  4. :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }"
  5. >

 我们需要在column中利用插槽来进行节点添加

  1. <vxe-column
  2. title="ENGUSER"
  3. field="enguser"
  4. sortable
  5. width="110"
  6. align="center"
  7. :edit-render="{ name: '$select' }"
  8. >
  9. <template #default="{ row }">
  10. <span>{{ formatSex(row.enguser) }}</span>
  11. </template>
  12. <template #edit="{ row }">
  13. <vxe-select v-model="row.enguser" transfer>
  14. <vxe-option
  15. v-for="item in selcetion"
  16. :key="item.value"
  17. :value="item.value"
  18. :label="item.label"
  19. />
  20. </vxe-select>
  21. </template>
  22. </vxe-column>
  23. <script lang="ts" setup>
  24. import { ref, reactive } from "vue";
  25. import { useEquipmentStore } from "#/store/modules/equipment/equipmentStore";
  26. const equipmentStore = useEquipmentStore();
  27. const selcetion = ref([
  28. { label: "false", value: "false" },
  29. { label: "true", value: "true" }
  30. ]);
  31. const formatSex = (value: string) => {
  32. if (value === "false") {
  33. return "false";
  34. }
  35. if (value === "true") {
  36. return "true";
  37. }
  38. };
  39. </script>

 

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/692022
推荐阅读
相关标签
  

闽ICP备14008679号