The following code works fine. When we change the language the text gets updated correctly thanks to the ref:
const mainNavigationLinks = computed(() => [
{ label: context.root.$t('navigationMenu.home') },
{ label: context.root.$t('navigationMenu.tickets') },
])
return {
mainNavigationLinks,
}
But what we would really like is to have the mainNavigationLinks as a reactive object, so we can add and remove items from the array and have Vue update the components accordingly with the correct translations by using the ref within the array. According to the Vue docs this should be possible
However, when we try the code below we see that the label is no longer reactive:
const mainNavigation = reactive([
{ label: context.root.$t('navigationMenu.home') },
{ label: context.root.$t('navigationMenu.tickets') },
])
const mainNavigationLinks = computed(() => mainNavigation)
What are we missing here to be able to add items to the array and still have it reactive? Thank you for your help.