element-plus/docs/examples/carousel/auto-height.vue
热爱vue的小菜鸟 cd306117ae
feat(components): [carousel] If the carousel height is auto apply item height (#12388)
* fix(components): [carousel] :height is auto and card direction  vertical

* fix(components): [carousel] :height is auto and card direction vertical

* fix(components): [carousel] :height is auto and card direction 垂直

* feat(components): [carousel] height is adaptive when height is auto

* feat(components): [carousel] height is adaptive when height is auto

* fix(components): [carousel] :height is auto and card direction 垂直

* fix(components): [carousel] :height is auto and card direction 垂直

* fix(components): [carousel] :height is auto  test.tsx

* fix(components): [carousel] :height is auto and card direction

* fix: delete zIndex

* fix: delete ts type

* fix: add test

* fix: css modification

* fix: delete doc inside

* fix: Revise card width not adaptive

* fix: Modify calcCardTranslate

* fix: test

* fix: calcCardTranslate

* fix: remove redundant code
2023-05-14 17:47:43 +08:00

44 lines
1.0 KiB
Vue

<template>
<div class="block text-center" style="height: 300px">
<span class="demonstration">each carousel-item has a different height</span>
<el-carousel height="auto" autoplay>
<el-carousel-item style="height: 100px">
<h3 class="small justify-center" text="2xl">height 100px</h3>
</el-carousel-item>
<el-carousel-item style="height: 200px">
<h3 class="small justify-center" text="2xl">height 200px</h3>
</el-carousel-item>
<el-carousel-item style="height: 300px">
<h3 class="small justify-center" text="2xl">height 300px</h3>
</el-carousel-item>
</el-carousel>
</div>
</template>
<style scoped>
.carousel-item {
color: #475669;
opacity: 0.75;
margin: 0;
text-align: center;
}
.el-carousel__item h3 {
color: #475669;
opacity: 0.75;
display: flex;
align-items: center;
margin: 0;
text-align: center;
height: 100%;
}
.el-carousel__item:nth-child(2n) {
background-color: #99a9bf;
}
.el-carousel__item:nth-child(2n + 1) {
background-color: #d3dce6;
}
</style>