How does el-input-number get the subscript

< el-input-number v controls-position= model = "item.buyNum": precision= "0" controls-position= "right" @ change= "handleChange": min= "1" > < / el-input-number >

handleChange (value) {
console.log (value)
}
so I can get the value, but mine is cyclic and I want to get the corresponding subscript at the same time. If I write
< el-input-number v right model = "item.buyNum": precision= "0" controls-position= "right" @ change= "handleChange (index)": min= "1" > < / el-input-number >
handleChange (value,index) {
console.log (value,index)
}
will print

ask how to get index at the same time

Jul.14,2021

in fact, you have already got the index. You can get the bound value according to the index. The parameters you passed have overwritten the callback of the original event.
wrote demo:
clipboard.png

slightly.

https://jsfiddle.net/4w7tnpvo/


you have already got the index, so you can get the corresponding value in the array according to this. For example, the array is list, this.list [index] .buyNum is the value you want.

or try this:
@ change= "handleChange (index)" change to @ change= "handleChange (item.buyNum, index)"

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf8619-54d4e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf8619-54d4e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?