Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

Support Arrays[] #170

Open
buglist3r opened this issue Sep 6, 2021 · 1 comment
Open

Support Arrays[] #170

buglist3r opened this issue Sep 6, 2021 · 1 comment

Comments

@buglist3r
Copy link

Is there any possibilities to support arrays for example i need to use something like that

 headers: [
   {value: 'due', label: 'Fälligkeit'},
   {value: 'name', label: 'Name'},
 ]

Then i can simply loop through it which is default case with Vue i18n

<div v-for="header in $t('headers')">
   <div> {{ header.value }} </div>
    <div> {{ header.name }} </div>
</div>

Thank you

LG
Adel

@afv
Copy link

afv commented Dec 7, 2021

You need the returnObjects option.

JSON:

{
  "headers": [
    {
      "value": "due",
      "label": "Fälligkeit"
    },
    {
      "value": "name",
      "label": "Name"
    }
  ]
}

Template:

<div
  v-for="(header, index) in $t('headers', { returnObjects: true })"
  :key="`header-${index}`"
>
  {{ header.value }} - {{ header.label }}
</div>

Output:

due - Fälligkeit
name - Name

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants