Does element not support v-model.lazy?

uses the .modifier modifier, but every character you enter will trigger an event in watch. How can you change the value and trigger watch after onchange?

<el-input 
    type="number" 
    v-on:change="changeGrabAmount"
    v-model.lazy="dialogParam.grabAmount" 
    :disabled="disableBtnGrabmount"
    >
</el-input>
watch:{
     "dialogParam.grabAmount": function(val) {
         //...
     }
}
Dec.22,2021

try .native.treat
Why don't you handle it in onchange


The

.update modifier does not delay the completion of the data update. In fact, the data bound by your v-model is still updated, but it is not displayed in data, but watch can still listen, so it will still trigger watch, even if you use the .notify modifier
to achieve the function you want, you can define an intermediate amount overload and then handle it in the v-on:change event. Look at the code

<el-input 
    v-on:change="changeGrabAmount"
    v-model="tmp" 
    :disabled="disableBtnGrabmount"
    >
</el-input>

data() {
    return {
        tmp: "",
        dialogParam: {
          grabAmount: ""
        }
    };
},
methods: {
    changeGrabAmount(val){
        this.dialogParam.grabAmount = val
    }
},
watch:{
    "dialogParam.grabAmount": function(val) {
        //...
     }
}

the first line of the Element component is explained in the first line of the input input box component on the Chinese official website. The v-model modifier is not supported.

ex:
Input is a controlled component, and it always displays the Vue binding value .

in general, you should handle the input event and update the binding value of the component (or use v-model ). Otherwise, the value displayed in the input box will not change.

The v-model modifier is not supported for

.

Menu