0

I have an array of dates, I also have an object that looks like this:

[
{'2020-04-01': {name: 'john', sex: 'male'}, 'id': 222},
{'2020-04-02': {name: 'jane', sex: 'female'}, 'id': 111}
]

Now for some reason, I used html table instead of vue datatable and when I access the date key, nothing shows. The rendering goes like this..

...
...
<tbody>
    <tr v-for="item in body_data">
        <template v-for="date in date_range">
            <td>{{item.id}}</td> //works fine
            <td>{{item.date.name}}</td> //shows nothing, also no error
        </template>
    </tr>
</tbody>

Is it because I cant have a date as key? Or did I just call it wrongly?

Sorry for bad english

1
  • 1
    You need to convert the dates to a string and then access the items as item[date].name Commented Apr 19, 2020 at 12:50

1 Answer 1

1

should be:

<td>{{item[date].name}}</td>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.