在table数据中加一个disabled属性的值
async getData() {
let vm = this;
vm.loading = true;
let list = await vm.$fetch(vm.$path+'received/BatchCodeWithdrawalInfo/', {
page: vm.cur_page,
size: vm.pageSize,
search: vm.select_word,
});
vm.loading = false;
if( list){
let table = list.dataInfo.listData;
// vm.tableData.newParam ='vVisible';
if(table){
for(let i=0; i<table.length; i++){
table[i]["vVisible"] = true;
}
}
vm.tableData = table;
vm.totalcount = list.dataInfo.pageInfo.total_size;
}
}, // 获取table数据
将disabled属性动态绑定至对象中对应的vVisible中
<el-table-column
align="center"
prop=""
label="样品信息"
width="120">
<template slot-scope="scope">
<el-input v-model="scope.row.sample_info" :disabled='scope.row.vVisible'>
</el-input>
</template>
</el-table-column>
点击事件传递index参数
<el-button
@click="handleEdit(scope.$index, scope.row)" size="small" type="primary" round>编辑
</el-button>
改变点击行的disabled属性
handleEdit(index,row){
if(this.tableData[index].vVisible == false){
this.tableData[index].vVisible=true;
}else{
this.tableData[index].vVisible = false;
}
}, // 退仓信息是否可编辑