Is it possible to reduce the height of a <v-carousel>
? I saw in the documentation that they were working on it, but has it been implemented yet? If not is there a work around? I'm just trying to set a max height.
8
votes
4 Answers
5
votes
4
votes
1
votes
If you want dynamic height of v-carousel based on image, for example.
You can use something like this:
example:
<v-carousel :style="{'height': this.carouselHeight}">
<v-carousel-item v-for="(item, index) in items" :key="index" style="height: auto" :src="item.image"></v-carousel-item>
</v-carousel>
- set data prop:
data () { return { carouselHeight: 0 { }
- create method:
getCarouselHeight () { var item = document.getElementsByClassName('v-image__image--cover') this.carouselHeight = item[0].clientHeight + 'px' }
- call method on mounted:
mounted () { this.getCarouselHeight() }