Javascript 如何使用单个插槽修改数据表中的任何列

Javascript 如何使用单个插槽修改数据表中的任何列,javascript,vue.js,vuejs2,vuetify.js,Javascript,Vue.js,Vuejs2,Vuetify.js,我使用vuetify创建了一个可重用的数据表。一切正常。我已经传递了标题和项目,作为在不同组件中使用数据表的道具 我使用的是slot,但使用的是一些不同的方法,即带有if/else条件的基于列的解决方案。但是,我需要一个插槽,所以它不能以组件为中心 这是我的示例数据表代码 <v-data-table :headers="headers" :items="items" :items-per-page="8" :hide-defaul

我使用vuetify创建了一个可重用的数据表。一切正常。我已经传递了标题项目,作为在不同组件中使用数据表的道具

我使用的是slot,但使用的是一些不同的方法,即带有if/else条件的基于列的解决方案。但是,我需要一个插槽,所以它不能以组件为中心

这是我的示例数据表代码

<v-data-table
:headers="headers"
:items="items"
:items-per-page="8"
:hide-default-footer="true"
hide-actions
item-key="name"
class="elevation-1"
>
<template slot="items" slot-scope="props">
  <td v-for="(header, index) in headers" :key="index">
      <template v-if="(header.type === 'aId')">
            {{ props.item[header.value] }}
      </template>
      <template v-else-if="(header.type === 'aName')">
            {{ props.item[header.value] }}
      </template >
      <template v-else>
            {{ props.item[header.value] }}
      </template>
  </td>
 </template>
 </v-data-table>

{{props.item[header.value]}
{{props.item[header.value]}
{{props.item[header.value]}
在这里,我在表头字段中传递一个“模板”属性,根据条件,我可以更改相应的列,但它听起来是特定于组件的。有更好的方法吗?

CustomDataTable.vue

<template>
  <v-data-table ...>
    <template v-for="(_, slot) of $scopedSlots" v-slot:[slot]="scope">
      <slot :name="slot" v-bind="scope"/>
    </template>
  </v-data-table>
</template>

感谢您的回复。你能详细说明一下吗?