elementUI is usedasync-validatorPerform form verification, but when I use the drop-down tree (el-cascader), I find that it does not trigger actively, so I can only trigger actively, the method is as follows:
this.$refs['form'].fields[0].validateMessage = 'error message'
this.$refs['form'].fields[0].validateState = 'error'
Supplementary knowledge:element-ui Open the page to trigger the verification problem
If you set to close the pop-up page, resetFields(). Opening the page at this time still triggers the verification effect. It is generally caused by the drop-down box and time selection. The solution is to change the verification rules.
endTime: [{ type: 'string', required: true, message: 'Please select', trigger: 'blur' }],
type: [{ type: 'number', required: true, message: 'Please select', trigger: 'blur' }],
At this time, your drop-down selection type must be correct, just like me, the value of the drop-down box is number, then here is number. If the value corresponding to your drop-down box is string, the type will change accordingly.
At the same time, element-ui has a pit, time zone problem, which causes the time to be transmitted to the background and the time to be selected to be eight hours apart. At this time, you need to set it.
value-format="yyyy-MM-dd HH:mm:ss"
In this way, passing to the background is a string. When verifying, you need to follow the rules of endTime.
The above article vue element ui validate actively triggering error prompt operation is all the content I share with you. I hope you can give you a reference and I hope you support me more.