<el-table @cell-dblclick="editCell">
<el-table-column :key="randomKey" prop="name">
<template slot-scope="{row,column}" >
<el-select
v-show="row[column.property + 'isShow']"
:ref="column.property"
@blur="alterData(row,column)">
<el-option></el-option>
</el-select>
<span v-show="!row[column.property + 'isShow']">文本</span>
</template>
</el-table-column>
</el-table>
editCell(row, column){
row[column.property + 'isShow'] = true
this.refreshTable()
this.$nextTick(() => {
this.$refs[column.property] && this.$refs[column.property].focus()
})
},
refreshTable () {
this.randomKey = Math.random()
},
alterData (row, column) {
row[column.property + 'isShow'] = false
},