-
I have problems using vue-i18n translations as fallback value for a component property. <script setup>
// t will not be available when props are checked because defineProps is extracted from setup
const {t} = useI18n()
const props = defineProps({
label: {
type: String,
default: () => t('fallback-label'),
},
})
</script> What is the indented way to make this work? |
Beta Was this translation helpful? Give feedback.
Answered by
dpschen
May 24, 2022
Replies: 1 comment
-
Okay not sure why it didn't work out in the first place, but I got it now running like this: <script setup>
import {useI18n} from 'vue-i18n'
const props = defineProps({
label: {
type: String,
default() {
const {t} = useI18n()
return t('fallback-label');
},
},
})
</script> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
dpschen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Okay not sure why it didn't work out in the first place, but I got it now running like this: