vue form form validation clear

Clear form content and clear form validation messages

 this.$nextTick(() => {

      this.$refs['formData'].resetFields();

 })

Only clear the form validation message, not the form content

 this.$nextTick(() => {

      this.$refs['formData'].clearValidate()

 })

 When clearing the form validation message does not work, you can try the following

setTimeout(() => {

     this.$refs['formData'].clearValidate();

}, 30);

formData refers to the object
<el-form ref="formData " :model="formData bound to the current form"/> 

Guess you like

Origin blog.csdn.net/m0_59735348/article/details/126814587