赞
踩
首先在vxe-table标签中开启单元格可编辑配置
-
- <vxe-table
- ref="xTable"
- border
- :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }"
- >
我们需要在column中利用插槽来进行节点添加
- <vxe-column
- title="ENGUSER"
- field="enguser"
- sortable
- width="110"
- align="center"
- :edit-render="{ name: '$select' }"
- >
- <template #default="{ row }">
- <span>{{ formatSex(row.enguser) }}</span>
- </template>
- <template #edit="{ row }">
- <vxe-select v-model="row.enguser" transfer>
- <vxe-option
- v-for="item in selcetion"
- :key="item.value"
- :value="item.value"
- :label="item.label"
- />
- </vxe-select>
- </template>
- </vxe-column>
-
- <script lang="ts" setup>
- import { ref, reactive } from "vue";
- import { useEquipmentStore } from "#/store/modules/equipment/equipmentStore";
- const equipmentStore = useEquipmentStore();
- const selcetion = ref([
- { label: "false", value: "false" },
- { label: "true", value: "true" }
- ]);
- const formatSex = (value: string) => {
- if (value === "false") {
- return "false";
- }
- if (value === "true") {
- return "true";
- }
- };
- </script>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。