3👍
✅
How to show the status:
Status
needs to be a part ofitem
, or else the status is going to be the same for all items. So change<td>{{status}}</td>
to<td>{{item.status}}</td>
.
And change{ text: 'status', value: '' }
to{ text: "status", value: "status" }
.this.items.id
is not valid sincethis.items
is an array.- Also when you check if a value is equal a string you should use
===
, which means equal value and equal type. See more about comparisons here: https://www.w3schools.com/js/js_comparisons.asp
What I would do is to add the status
while mapping the items:
this.items = response.data.map(item => {
const newStatus =
item.id === '1' || item.id === '3' ? 'supercustomer' : '';
return {
id: item.id,
email: item.email,
name: item.name,
status: newStatus
};
});
Source:stackexchange.com