basic.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <div class="block text-center">
  3. <span class="demonstration"
  4. >Switch when indicator is hovered (default)</span
  5. >
  6. <el-carousel height="150px">
  7. <el-carousel-item v-for="item in 4" :key="item">
  8. <h3 class="small justify-center" text="2xl">{{ item }}</h3>
  9. </el-carousel-item>
  10. </el-carousel>
  11. </div>
  12. <div class="block text-center" m="t-4">
  13. <span class="demonstration">Switch when indicator is clicked</span>
  14. <el-carousel trigger="click" height="150px">
  15. <el-carousel-item v-for="item in 4" :key="item">
  16. <h3 class="small justify-center" text="2xl">{{ item }}</h3>
  17. </el-carousel-item>
  18. </el-carousel>
  19. </div>
  20. </template>
  21. <style scoped>
  22. .demonstration {
  23. color: var(--el-text-color-secondary);
  24. }
  25. .el-carousel__item h3 {
  26. color: #475669;
  27. opacity: 0.75;
  28. line-height: 150px;
  29. margin: 0;
  30. text-align: center;
  31. }
  32. .el-carousel__item:nth-child(2n) {
  33. background-color: #99a9bf;
  34. }
  35. .el-carousel__item:nth-child(2n + 1) {
  36. background-color: #d3dce6;
  37. }
  38. </style>