0

I can use <b-table-simple> with GraphQL queries and it works fine, for example:

<b-table-simple>
      <b-tbody>
        <b-tr role="row" v-for="page in $page.allGoogleSheet.edges" :key="page.id">
          <b-td>
            {{page.node.Name}}
          </b-td>
          <b-td>
            {{page.node.Age}}
          </b-td>
          <b-td>
            {{page.node.Height}}
          </b-td>
        </b-tr>
      </b-tbody>
</b-table-simple>

But how can i do this with <b-table>?

4

1 回答 1

0

您需要定义要从每一行数据中提取的字段:

<template>
  <b-table :fields="fields" :items="$page.allGoogleSheet.edges">
  </b-table>
</template>

<script>
export default {
  data() {
    return {
      fields: [
        // Add this entry if you want to see the ID of the entry
        // { key: 'id', label: 'ID' },
        { key: 'node.Name', label: 'Name' },
        { key: 'node.Age', label: 'Age' },
        { key: 'node.Height', label: 'Height' },
      ]
    }
  }
}
</script>
于 2020-03-12T20:29:19.533 回答