If you are fed up with Ele.me’s ElementUI’s native verification method, then give it a try!
Although Ele.me’s ElementUI is good, the form verification experience is not ideal.
If product development must pay attention to user experience, then plug-in development must also pay attention to development experience, and a good development experience must be guaranteed by good API design.
I have been focusing on the development of verification plug-ins for 30 years, and I have an ancestral verification plug-in API design (joke). Mainly referring to the vue-verify-pop API written before, and improving it, taking its essence, removing its dross, and kneading the essence of the sun and the moon. . .
This plug-in only encapsulates ElementUI's original verification method. The core validator is still async-validator, which is non-intrusive and will not affect your continued use of ElementUI's native verification at all.
< template >
< el-form label-width =" 100px " :model =" model " >
< el-form-item label ="年龄" prop =" age " verify int :gt =" 0 " >
< el-input v-model =" model.age " > </ el-input >
</ el-form-item >
</ el-form >
</ template >
< script >
export default {
data ( ) {
return {
model : {
age : ""
}
} ;
}
} ;
</ script >
ok, you have completed an integer check with content greater than 0! (Welcome to compare similar examples with the official version)
https://aweiu.com/documents/element-ui-verify/