SmallSwiper.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <div class="swiper">
  3. <el-carousel :interval="5000" arrow="always" height="214px" indicator-class="custom-indicator">
  4. <el-carousel-item v-for="item in 4" :key="item">
  5. <img src="../../static/images/sgbhsihfgisdfaasda45632113_A_group_of_Chinese_farmers_are_trans_bb6f6cc3-e86b-4706-840c-0974beef5b2f@2x.png"
  6. alt="">
  7. <span>高邮市周山镇开展渔业安全生产应急...</span>
  8. </el-carousel-item>
  9. </el-carousel>
  10. </div>
  11. </template>
  12. <script setup>
  13. import { ElCarousel, ElCarouselItem } from 'element-plus'
  14. </script>
  15. <style lang="less" scoped>
  16. .swiper {
  17. width: 380px;
  18. height: 214px;
  19. position: relative;
  20. img {
  21. width: 380px;
  22. height: 214px;
  23. }
  24. span {
  25. display: inline-block;
  26. width: 380px;
  27. height: 30px;
  28. line-height: 30px;
  29. padding-left: 13px;
  30. position: absolute;
  31. top: 0;
  32. left: 0;
  33. font-family: PingFang SC, PingFang SC;
  34. font-weight: 500;
  35. font-size: 20px;
  36. color: #FFFFFF;
  37. background-color: rgba(0, 0, 0, 0.5);
  38. }
  39. }
  40. .el-carousel {
  41. /deep/.el-carousel__arrow i {
  42. font-size: 30px !important;
  43. }
  44. /deep/.el-carousel__arrow--left {
  45. left: 16px;
  46. width: 35px;
  47. height: 57px;
  48. color: #616358;
  49. background: #dcdedc;
  50. position: absolute;
  51. left: 0px;
  52. border: none;
  53. border-radius: 0;
  54. }
  55. /deep/.el-carousel__arrow--right {
  56. right: 16px;
  57. width: 35px;
  58. height: 57px;
  59. color: #616358;
  60. background: #dcdedc;
  61. position: absolute;
  62. right: 0;
  63. border: none;
  64. border-radius: 0;
  65. }
  66. /deep/ .el-carousel__indicators {
  67. // 指示器
  68. left: unset;
  69. transform: unset;
  70. right: 41%;
  71. }
  72. /deep/ .el-carousel__button {
  73. // 指示器按钮
  74. width: 10px;
  75. height: 10px;
  76. border: none;
  77. border-radius: 50%;
  78. border: 1px solid #fff;
  79. background-color: transparent;
  80. }
  81. /deep/ .is-active .el-carousel__button {
  82. // 指示器激活按钮
  83. background: #fff;
  84. }
  85. /deep/ .el-carousel__container {
  86. height: 100%;
  87. }
  88. }
  89. .custom-indicator button {
  90. background-color: #fff;
  91. border: 1px solid #ccc;
  92. opacity: 0.7;
  93. }
  94. .custom-indicator button.is-active {
  95. background-color: #333;
  96. border-color: #333;
  97. opacity: 1;
  98. }
  99. </style>