小编Sak*_*kil的帖子

如何使用vuetify数据表显示数组的索引?

我有来自服务器的响应,它将数据数组传递给我的vue实例.我已经使用该数组完成了数据表.但是我需要知道如何显示序列号的数组索引.

在这里我附加我的组件代码我的响应是好的,表也可以.我只需要增加一列,并在那里显示索引值.

提前Tnks我的阵列名称是客户.

<v-data-table
  v-bind:headers="headers"
  v-bind:items="customers"
  v-bind:search="search"
  v-cloak
  >
  <template slot="items" scope="props">
  <td class="text-xs-center">@{{ props.item.id }}</td>
  <td class="text-xs-center">
    <v-edit-dialog
      lazy
      @{{ props.item.name }}
      >
      <v-text-field
        slot="input"
        label="Edit"
        v-model="props.item.name"
        single-line
        counter
        :rules="[max25chars]"
        ></v-text-field>
    </v-edit-dialog>
  </td>
  <td class="text-xs-center">@{{ props.item.email }}</td>
  <td class="text-xs-center">@{{ props.item.email }}</td>
  <td class="text-xs-center">@{{ props.item.created_at }}</td>
  <td class="text-xs-center">
    <v-btn small outline fab class="red--text" @click="showWarning(props.item.id)">
      <v-icon>mdi-account-remove</v-icon>
    </v-btn>
    <v-btn small outline fab class="green--text" @click="showWarning(props.item.id)">
      <v-icon>mdi-account-off</v-icon>
    </v-btn>
  </td>
  </template>
  <template slot="pageText" scope="{ pageStart, pageStop }">
    From @{{ pageStart }} to @{{ pageStop }} …
Run Code Online (Sandbox Code Playgroud)

arrays datatables laravel vue.js vuetify.js

13
推荐指数
4
解决办法
1万
查看次数

标签 统计

arrays ×1

datatables ×1

laravel ×1

vue.js ×1

vuetify.js ×1