Title

1. 在el-input绑定@input事件

 2. 在data中定义timer为null

 3.在methods中定义@input绑定的方法

 4. 在setTimeout中调用对应处理的方法

<el-input style="width: 140px;color:#FF8900" size="small" v-model="singleDiscountForm.discount" @input="inputDiscount()">
            </el-input>


data(){
    return{
       tiemr:null,      
    }
},

methods:{
     inputDiscount() {
        if(this.timer){
          clearTimeout(this.timer)
        }
        this.timer=setTimeout(()=>{
          this.calculateDiscount();
        },600)
    },    
}

 

posted on 2023-04-27 14:51  chccee  阅读(512)  评论(0编辑  收藏  举报