You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm adding this example as an issue for those who wants to know how to integrate this awesome lib with ant design for vuejs (antd).
If you go to ant input docs you will find an example of a customized form control. If the link does not scroll to the correct doc section, all you just need to do is to search for "Customized Form Controls".
As you can see, to use antd with 3rd party libraries, there are somre requirements that should be follwed:
Customized or third-party form controls can be used in Form, too. Controls must follow these conventions:
It has a controlled property value or other name which is equal to the value of valuePropName-parameters).
It has event onChange or an event which name is equal to the value of trigger-parameters).
It must be a class component.
Here I'll show you how to create a masked input for brazilian phone input numbers and I'll also use class components and typescript but you can quickly convert the code to "pure" vuejs code. So, let's get our hands dirty!
First of all, you need to create an wrapper component to your custom input like this:
Here, antd will pass initialValue from v-decorator to our BRLPhoneInput component as a prop and everything will work perfectly as expected! See demo below.
Hope it hepls!
The text was updated successfully, but these errors were encountered:
I'm adding this example as an issue for those who wants to know how to integrate this awesome lib with ant design for vuejs (antd).
If you go to ant input docs you will find an example of a customized form control. If the link does not scroll to the correct doc section, all you just need to do is to search for "Customized Form Controls".
As you can see, to use antd with 3rd party libraries, there are somre requirements that should be follwed:
Here I'll show you how to create a masked input for brazilian phone input numbers and I'll also use class components and typescript but you can quickly convert the code to "pure" vuejs code. So, let's get our hands dirty!
First of all, you need to create an wrapper component to your custom input like this:
And use it in another component!
Here, antd will pass
initialValue
fromv-decorator
to ourBRLPhoneInput
component as aprop
and everything will work perfectly as expected! See demo below.Hope it hepls!
The text was updated successfully, but these errors were encountered: