In my current project, I am utilizing the vue-datepicker plugin. The documentation states that you can set the language as follows:
<datepicker :language="nl" />
Additionally,
import {nl} from 'vuejs-datepicker/dist/locale'
And
data() {
return {
nl: nl
}
}
I have a question: Is it feasible to use a variable from a parent component or an environment file to achieve this?
For example:
CountryCode = "nl" //Obtained from elsewhere
<datepicker :language=CountryCode />
import {CountryCode} from 'vuejs-datepicker/dist/locale'
data() {
return {
CountryCode: CountryCode
}
}
I understand that the above code is not accurate, but I am attempting to illustrate my point. Hopefully that clarifies things.