Problem scenario: Recently, when developing a project, I encountered such a problem: protocolId: { required: true, message: 'Please select the parsing protocol', trigger: 'blur'}, ], This can realize the verification function, but there will be a problem. If the verification condition (submit button) is triggered and an error message is prompted, the error message will still exist even if the data is reselected later, because the submit button is not clicked again to trigger the verification. This user experience is not very good. Solution:1. Check the fields individually Click the Save button to trigger the validation, which generally validates all fields. this.$refs.addForm.validateField('protocolId', (valid) => { //valid returns the error message written in the rule set. If the conditions are met, the return value is empty if (!valid) { return } }) The above code can be executed in a function that confirms data selection, so that this special content is checked again. If it meets the verification rules, the error prompt disappears. 2. Directly clear the prompt information of the field under the form fieldthis.$refs.addForm.clearValidate(); This method is to directly clear the error message without making any judgment. I personally do not recommend it. This concludes this article on how to clear verification prompts for element form validation. For more information on clearing verification prompts for element form validation, please search previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
>>: How does MySQL connect to the corresponding client process?
This article shares the specific code for JavaScr...
Table of contents Hbase installation and configur...
Table of contents 1. for loop 2. Double for loop ...
I encountered a case at work that I had never wri...
Analyze the execution process. Move the mouse int...
TabIndex is to press the Tab key to sequentially o...
<textarea></textarea> is used to crea...
as follows: -m, --memory Memory limit, the format...
You can have the best visual design skills in the...
This old question has troubled countless front-end...
Today, I want to write about a "low-tech&quo...
name character name character information news te...
Effect picture: Implementation code: <template...
When joining a Windows 2008 server subdomain to a...
Usually the pictures uploaded by users need to be...