0

I'm programming a survey in bootstrap vue. When i'm trying to display the carousel the chrome inspector tells me that the height is 0, but when i change it, it just display a gray square with carousel property but not shown my cards.

Thank's you for your help in advance!

<template class="bg-light">
  <b-col offset-lg="4" lg="4" sm="12">
    <b-form>
      <b-carousel
        id="carousel-1"
        v-model="slide"
        :interval="0"
        controls
        indicators
        background="#ababab"
      >
        <b-carousel-slide v-for="q in questions" v-bind:key="q.questionid">
          <b-card class="border-info"  >
            <b-card-header class="bg-warning">{{q.question}}</b-card-header>
            <b-card-body>
              <b-check-group >
                <b-checkbox :id="q.rep1.id" :value="q.rep1.id">{{q.rep1.text}}</b-checkbox>
                <b-checkbox :id="q.rep2.id" :value="q.rep2.id">{{q.rep2.text}}</b-checkbox>
                <b-checkbox :id="q.rep3.id" :value="q.rep3.id">{{q.rep3.text}}</b-checkbox>
                <b-checkbox :id="q.rep4.id" :value="q.rep4.id">{{q.rep4.text}}</b-checkbox>
              </b-check-group>
            </b-card-body>
          </b-card>
        </b-carousel-slide>
        </b-carousel>
    </b-form>
  </b-col>
</template>
Awais
  • 4,752
  • 4
  • 17
  • 40

1 Answers1

2

You need to utilize the img slot in your b-carousel-slide to add custom markup inside a slide.

<b-col offset-lg="4" lg="4" sm="12">
  <b-form>
    <b-carousel
      id="carousel-1"
      v-model="slide"
      :interval="0"
      controls
      indicators
      background="#ababab"
    >
      <b-carousel-slide v-for="q in questions" :key="q.questionid">
        <template v-slot:img>
          <b-card class="border-info" no-body>
            <b-card-header class="bg-warning">{{q.question}}</b-card-header>
            <b-card-body>
              <b-check-group>
                <b-checkbox :id="q.rep1.id" :value="q.rep1.id">{{q.rep1.text}}</b-checkbox>
                <b-checkbox :id="q.rep2.id" :value="q.rep2.id">{{q.rep2.text}}</b-checkbox>
                <b-checkbox :id="q.rep3.id" :value="q.rep3.id">{{q.rep3.text}}</b-checkbox>
                <b-checkbox :id="q.rep4.id" :value="q.rep4.id">{{q.rep4.text}}</b-checkbox>
              </b-check-group>
            </b-card-body>
          </b-card>
        </template>
      </b-carousel-slide>
    </b-carousel>
  </b-form>
</b-col>
Hiws
  • 8,230
  • 1
  • 19
  • 36