我们在获取后端数据的时候,有时候会在列表中生成很多的input,而我们又想实时监听这些input时要如何处理呢

<tr v-for="(item,index) in bstp" v-if="bstp">
    <td><input type="text" name="" @input="newVal(index,item.value)" v-model="item.value"></td>
</tr>

使用方法在input值发生改变时修改数据

newVal(index,v){
    let n=parseInt(v);
    if(n<0 || isNaN(n)){
        n=0;
    }
    this.bstp[index].value=n;
}
Logo

前往低代码交流专区

更多推荐