首页 > 其他分享 >vue+elementui 的表格单元格内修改数据

vue+elementui 的表格单元格内修改数据

时间:2022-10-17 17:45:37浏览次数:40  
标签:vue elementui cellInput 单元格 changeBefore value var changeAfter row

cellDbClick (row, column, cell, event) {       var that = this           event.target.innerHTML = ''           var cellInput = document.createElement('input')           cellInput.value = row[column.property] ? row[column.property] : ''           cellInput.setAttribute('type', 'text')           cellInput.setAttribute('class', 'inputClass')           cellInput.style = 'width:60%;margin-left:10px;padding-left:5px;border:1px solid #DCDFE6;border-radius:4px;color:#606266;height:28px;line-height:28px;'           cell.appendChild(cellInput)           var changeBefore = cellInput.value           //   聚焦           cellInput.focus()           // 失焦事件           cellInput.onblur = () => {             var changeAfter = cellInput.value             // console.log(changeBefore, changeAfter, 'changeBefore, changeAfter')             if (changeAfter !== changeBefore) {               var params = {                 main: row.main,                 detail: row.detail,                 type: row.type,                 quantity: cellInput.value               }               that.updateOne(params)  // 调接口修改数据               cell.removeChild(cellInput)               event.target.innerHTML = cellInput.value               row[column.property] = cellInput.value           }         }       }     },

标签:vue,elementui,cellInput,单元格,changeBefore,value,var,changeAfter,row
From: https://www.cnblogs.com/xzzzys/p/16800007.html

相关文章