Answer the question
In order to leave comments, you need to log in
How to properly set up data output in VueJS?
So it goes.
Here is the abbreviated JSON data format:
Items: [
{
name: 'Lawnmower',
fields: [ 1, 4, 5 ]
},
{
name: 'Crusher',
fields: [ 2, 3 ]
}
],
customFields: [
{
id: 1,
name: 'Horsepower'
},
{
id: 2,
name: 'Engine type'
},
{
id: 3,
name: 'Is work?'
},
{
id: 4,
name: 'Year of Issue'
},
{
id: 5,
name: 'EXP.'
}
]
<tr v-for="idx in Items" v-if="field = customFields[idx]">
Answer the question
In order to leave comments, you need to log in
Я тебе уже 3 раза давал схожий ответ, но ты упорно пилишь велосипеды.
При клике на строку выставляй selectedItem, и затем просто:
<tr v-for="idx in selectedItem.fields">
<td>{{ customFields[idx].id }}</td>
<td>{{ customFields[idx].name }}</td>
</tr>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question