4 回答

TA貢獻(xiàn)1848條經(jīng)驗(yàn) 獲得超6個(gè)贊
經(jīng)過我公司的大牛指導(dǎo),寫出來了.但是好像不是太懂.我代碼給各位
<el-table-column prop="orderCount" label="排序序號(hào)">
<template slot-scope="{row,$index}">
<div @click="{{chengenum($index)}}">
<el-input v-if="editable[$index]" v-model='grade'></el-input>
<span v-else>{{row.orderCount}}</span>
</div>
</template>
</el-table-column>
//這是上面的靜態(tài)
let arr = _this.tableData = list_date.list; //這個(gè)_this.tableData是請(qǐng)求數(shù)據(jù)過來之后要渲染的列表
let len = arr.length;
new Array(len)
_this.editable = new Array(len);
// _this.editabl這個(gè)是控制顯示隱藏的量
data(){
editable:[],
}
//這是方法
chengenum(row){
this.editable[row] = true;
this.$set(this.editable,row,true)
},

TA貢獻(xiàn)2041條經(jīng)驗(yàn) 獲得超4個(gè)贊
<span class='abc' @click=“setEdit($event)”>{{scope.row.orderCount}}</span>
setEdit(event){
let target=event.target;
//設(shè)置target的contenteditable屬性為true,
并添加target的blur事件監(jiān)聽用于更新它的值
}
添加回答
舉報(bào)