dynamic table

Posted 6 months ago by Aetrox


i build a little data-table to output different data with one vue-component. the problem is, the object keys are not the same for each table. There are always 2 columns but it can be "ID, Name" or "Extension, Name".

I tried for 2 days but couldnt find a solution to use prop-values as object keys in v-for. this is what it actually looks:

    <div style="overflow: auto; height: 500px;">
        <table class="table">
                <tr><th class="w-25" v-for="field in fields">{{field}}</th></tr>
                <tr v-for="item in data"><td class="w-25">{{}}</td><td>{{}}   </td></tr>


export default {
    props: ['data','fields']


I would need something like item.field[0] and item field[1], but i didnt knew how to get this working. Is it possible or has someone a hint how to get this working?

Thanks in Advance.


Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.