共计 526 个字符,预计需要花费 2 分钟才能阅读完成。
如以下循环失去的 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”) 的用法
正文完
发表至: javascript
2022-03-11