I am using vue-datepicker plugin in my project. According to the docs, you set the language like this:
<datepicker :language="nl" />
And
import {nl} from 'vuejs-datepicker/dist/locale'
And
data() {
return {
nl: nl
}
}
My question is: Is it possible to use a variable coming from a parent component or an env file to load all of this ?
So something like this:
CountryCode = "nl" //Coming from somewhere
<datepicker :language=CountryCode />
import {CountryCode} from 'vuejs-datepicker/dist/locale'
data() {
return {
CountryCode: CountryCode
}
}
I know the code above is totally incorrect, but just trying to show what i mean, if that makes any sense.
If I'm not mistaken, the only types allowed for a prop are:
Even passing a Function is usually seen as an anti-pattern, unlike in React.
So, I doubt that this is possible and even if it could, it would be quite strange. So I don't recommend it anyway.