Member-only story
Ant Design Vue — Custom Validation and v-model
3 min readJan 13, 2021
Ant Design Vue or AntD Vue, is a useful UI framework made for Vue.js.
In this article, we’ll look at how to use it in our Vue apps.
Customized Validation
We can add the validation-status
prop to show the validation status on the form field:
<template>
<a-form :label-col="labelCol" :wrapper-col="wrapperCol">
<a-form-item
label="Fail"
validate-status="error"
help="Should be combination of numbers & alphabets"
>
<a-input id="error" placeholder="unavailable choice"/>
</a-form-item>
</a-form>
</template>
<script>
export default {
data() {
return {
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 12 }
}
};
}
};
</script>
The help
prop has the text that is below the form.
labelCol
has the size of the labels.
wrapper-col
has the wrapper’s columns.
Customized Form Controls
We can customize form controls by nesting our own controls into the a-form-item
component:
<template>
<a-form layout="inline" :form="form" @submit="handleSubmit">
<a-form-item label="Price">…