basic.vue 1.1 KB

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