I've trying to set the default value of a prop to a locale value using i18n.
I've tried the following but this gives me an error:. defineProps are referencing locally declared variables. What's the best way to handle this? 2525 bronze badges. 1,50311 gold badge1515 silver badges3535 bronze badges. 1515 silver badges3535 bronze badges.
defineProps is a compiler macro, so you can't use any runtime values within it. I'd suggest to use a local variable for this default:. Also described here in the last bullet point: https://v3.vuejs.org/api/sfc-script-setup.html#defineprops-and-defineemits.
Not the answer you're looking for? Browse other questions tagged internationalizationvuejs3 or ask your own question.
22 gold badges2222 silver badges5252 bronze badges.
It received a lot of positive feedback but also some concerns about the verbosity of the Composition API usage inside SFCs.