Skip to content Skip to sidebar Skip to footer

Vue.js Pass Slot To Wrapped Bootstrap-Vue Table Component

I'm trying to create a wrapper for the bootstrap-vue Table component. This component uses slots to define cell templates, like that: Copy

But since you may not know the slot names ahead of time, you would need to do something similar to the following:

<template>
  <div>
    <b-table :items="itemsProvider" v-bind="options" >
      <template v-for="slotName in Object.keys($scopedSlots)" v-slot:[slotName]="slotScope">
        <slot :name="slotName" v-bind="slotScope"></slot>
      </template>
    </b-table>
    <b-pagination
      v-model="currentPage"
      :total-rows="rows"
      :per-page="perPage"
    />
  </div>
</template>

Post a Comment for "Vue.js Pass Slot To Wrapped Bootstrap-Vue Table Component"