此问题是我在开发的过程当中遇到的,而且我上网搜了很久没有找到这个问题的解决办法,所以我便自己搞了出来,希望我写的文章对于大家有帮助
第一步
第一步呢我们可以使用插槽
{
title: 'Fe(铁)',
align: 'center',
children: [
{
title: '常规样',
align: 'center',
dataIndex: 'feContentThree',
slots: { customRender: 'editor' },
width: '80px',
},
{
title: '快样',
align: 'center',
dataIndex: 'quickFeContentTwo',
width: '80px',
},
{
title: '差值',
align: 'center',
dataIndex: 'feDifference',
width: '80px',
},
],
},
solts是插槽,其中的customRender这个属性的值可以随便设置,取决于自己
第二步
<template #editor="{ record, column, text }">
<Input v-if="isEdit && record.editable" v-model:value="record[column.dataIndex]" />
<span v-else>{{ text }}</span>
</template>
我们在这里用上Input组件再使用v-model这个vue的内置方法来同步此属性的值
isEdit这是我声明的变量,再点击的编辑的时候可以设置为true,点击取消的时候再给isEdit设置为false,
以上就是此问题的解决办法