![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/65dacb479fd969a929b2efde454eb957.png)
<!-- 开关表格 -->
<el-table-column v-else-if="!!column.switch" :key="column.prop" header-align="center"
align="center" :prop="column.prop" :label="column.label" :width="column.width"
:min-width="column.minWidth" :fixed="column.fixed" :type="column.type"
:sortable="!!column.sort" :show-overflow-tooltip="showOverflowTooltip"
>
<template slot-scope="scope">
<el-switch
v-model="scope.row[column.prop]"
:active-value="true"
:inactive-value="false"
@change="switchChange(column.switchMethod, $event, scope.row)"
/>
</template>
</el-table-column>
switchChange(method, active, row) {
this.$emit('switch', { method, active, row })
}
<!-- 可编辑表格 -->
<el-table-column v-else-if="!!column.edit && column.editType=='input' " :key="column.prop" header-align="center"
align="center" :prop="column.prop" :label="column.label" :width="column.width"
:min-width="column.minWidth" :fixed="column.fixed" :type="column.type"
:sortable="!!column.sort" :show-overflow-tooltip="showOverflowTooltip">
<template slot-scope="{row,$index}">
<el-input
v-if="showEdit[$index][column.prop]"
v-model="row[column.prop]"
:size="size"
@change="handleEdit(row, $index)"
@blur="inputBlur(row)"
v-focus
/>
<span v-if="!showEdit[$index][column.prop]">{{ row[column.prop] }}</span>
</template>
</el-table-column>
showEdit: [],
handleEdit(row, index, editType) {
this.data.content[index] = row
if (!!editType && editType == 'select') {
this.setShowEditInit()
this.$emit('cellDblclick', row)
}
},
inputBlur(row) {
this.setShowEditInit()
this.$emit('cellDblclick', row)
},