How can vee-validate clear the required input without triggering authentication?

the problem is that there is an input box on the page to enter the purchase quantity, but after the purchase is successful, you want to clear this input box:

question:
after emptying the box, it will automatically prompt to verify the error message, but do not want to do so, how to deal with it?

as follows:

<input type="text" name="quantity" v-validate=""required|qtyRule"" v-model.trim="qty" :placeholder="">

the following code simulates the user action:

    this.qty = 10;//10
    setTimeout(() => {
      this.qty = "";//5s
      
      //
      //console.log(this.errors)
      //console.log(this.$validator.errors)
      //this.$validator.remove("quantity")

    }, 5000);

add:

feels that this.$validator and this.errors are all delay objects. When debugging, this , this.$validator , this.errors all return undefined , but the console has output!

Mar.01,2021
The trigger of

v-validate has an event, such as "foucs", "blur", "change", and
you can change the trigger method or check the rules.
can also avoid this problem by converting tag patterns


found two ways:
1, dynamic verification instruction

v-validate="`${(alertType != 'smail' && !isShowAlertDialog) ? 'required|' : ''}quantityRule`"

this approach has obvious drawbacks: it relies on variables, making the logic more complex (unmaintainable); and when the dependent variable is false, validation is triggered immediately.

2. After it is set to empty, clear the error message directly (for some reason, the official website api is all clear (), but the method in this object is indeed clean ())

.
this.amount = '';
this.$validator.clean();

I also encountered this problem. How did the landlord solve this problem?


refresh after nextTick using the v-if feature of vue, and then emptying the data will not be verified. But the scene I use is to clear it all after switching. I wonder if


is useful.

`
this.$validator.remove ("quantity")`

change to
`
this.$validator.errors.remove ("quantity")`

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-1b34afd-2bf2d.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-1b34afd-2bf2d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?