1.select绑定默认值
2.接口字段返回0,1…枚举值,显示对应内容处理
3.table表格默认选中第一行
表格数据发生变化的时候,中间有个过程val值为null,所以用上面的处理方式,不然报错
4.table单元格可编辑
handleCellClick(row, column, cell, event){
for(let i=0;i<document.getElementsByClassName('current-cell').length;i++){
document.getElementsByClassName('current-cell')[i].classList.remove('current-cell');
}
cell.classList.add("current-cell");
document.getElementsByClassName('current-cell')[0].getElementsByTagName("input")[0].focus();
},
//失去焦点
handleInputBlur(){
document.getElementsByClassName('current-cell')[0].classList.remove('current-cell');
},
.table-data .el-input {
display: none
}
.current-cell .el-input {
display: block;
}
.current-cell .el-input + span {
display: none;
}
5.输入框聚焦时内容全选
<el-input v-model="scope.row.evaitemnote" @focus="focusSelect($event)" @blur="handleInputBlur"></el-input>
focusSelect (event) {//输入框聚焦时内容全选
event.currentTarget.select();
},