1

这是我在stakeoverflow 中的第一个问题。我是 vuejs 和 vue-table-2 的新用户。从列中我没有问题,但我想用我在数据库中的表中的数据填充行。这两天我只是在谷歌搜索来解决这个问题。任何人都可以解决这个问题?

<template>
  <div class="row">
    <div class="col-lg-12 mb-3">
      <b-card header="Data Paket" header-tag="h4" class="bg-success-card">
        <datatable title :rows="rowdata" :columns="columndata"></datatable>
      </b-card>
    </div>
  </div>
</template>
<script>
import Vue from "vue";
import axios from "axios";
import { ClientTable, Event } from "vue-tables-2";
import datatable from "components/plugins/DataTable/DataTable.vue";
Vue.use(ClientTable, {}, false);

export default {
  components: {
    datatable
  },
  data() {
    return {
      rowdata: [],

      columndata: [
        // Array of objects
        {
          label: "Name", // Column name
          field: "fname", // Field name from row
          numeric: false, // Affects sorting
          width: "200px", //width of the column
          html: false // Escapes output if false.
        },
        {
          label: "Last Name",
          field: "lname",
          numeric: false,
          html: false
        },
        {
          label: "age",
          field: "age",
          numeric: true,
          html: false
        },
        {
          label: "state",
          field: "state",
          numeric: false,
          html: false
        },
        {
          label: "Action",
          field: "button",
          numeric: false,
          html: true
        }
      ]
    };
  },

};
</script>
4

0 回答 0