如以下循环失去的el-input,共7*24个结构单元,
<div class="rate-input" v-for="(rate, columnIndex) of rates" :key="'columnIndex_'+columnIndex" > <el-input style="width: 50px; margin: 1px;" :row="rowIndex" :col="columnIndex" v-model="rowsRates[rowIndex][columnIndex]['val']" @blur="updateRate" maxlength="5" > </el-input> </div>
当blur 触发执行 updateRate 函数, 在其中可获取row 和col , 对所在行的其余元素做解决
updateRate(e){ let val = e.target.value let row = e.target.getAttribute("row") let col = e.target.getAttribute("col") // doing 失去value , 所在行列坐标, 开始解决你的业务逻辑吧 }
总结, 次要是e.target.value 和e.target.getAttribute("xxx")的用法