如以下循环得到的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")的用法


CUI_PING
42 声望3 粉丝