Tag Archives: Vue form validate error

Vue form validate error: Error in v-on handler “TypeError Cannot read properties of undefined (reading ‘indexOf‘)

The reason is that the form item uses v-if control and appears to be between two normal el-form-items. As follows.

Then when you use this.$refs[“specialForm”].resetFields(); to reset the form, it reports an error:

Solution:
Wrap a div outside el-form-item and use it as an if judgment to avoid it.