SmallSwiperTwo.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div class="swiper" v-if="data.length>0">
  3. <el-carousel :interval="5000" height="405px" indicator-class="custom-indicator" @change="handleIndicatorChange">
  4. <el-carousel-item v-for="item in data" :key="item">
  5. <NuxtLink
  6. :to="`/${item.pinyin}/${item.id}.html`"
  7. :title="item.title">
  8. <img :src="item.imgurl" :alt="item.title">
  9. <span class="swiper_dot1 dot1">{{ item.title }}</span>
  10. </NuxtLink>
  11. </el-carousel-item>
  12. </el-carousel>
  13. </div>
  14. </template>
  15. <script setup>
  16. import { ElCarousel, ElCarouselItem } from 'element-plus'
  17. //获取焦点图数据 start---------------------------------------->
  18. const props = defineProps({
  19. data:Array
  20. })
  21. let currentIndex = ref(0)
  22. let handleIndicatorChange = (val) => {
  23. currentIndex.value = val
  24. }
  25. //获取焦点图数据 end---------------------------------------->
  26. </script>
  27. <style lang="less" scoped>
  28. .dot1 {
  29. display: block;
  30. word-break: keep-all;
  31. white-space: nowrap;
  32. overflow: hidden;
  33. text-overflow: ellipsis;
  34. }
  35. .swiper {
  36. width: 100%;
  37. height: 405px;
  38. position: relative;
  39. img {
  40. width: 100%;
  41. height: 405px;
  42. }
  43. .swiper_dot1 {
  44. display: block;
  45. width: 100%;
  46. line-height: 60px;
  47. height: 60px;
  48. color: #fff;
  49. font-size: 24px;
  50. text-indent: 20px;
  51. position: absolute;
  52. bottom: 0;
  53. left: 0;
  54. z-index: 10;
  55. box-sizing: border-box;
  56. padding-right: 244px;
  57. background: rgba(0, 0, 0, .5);
  58. }
  59. }
  60. .el-carousel {
  61. /deep/.el-carousel__arrow i {
  62. font-size: 30px !important;
  63. }
  64. /deep/.el-carousel__arrow--left {
  65. left: 16px;
  66. width: 35px;
  67. height: 57px;
  68. color: #616358;
  69. background: #dcdedc;
  70. position: absolute;
  71. left: 0px;
  72. border: none;
  73. border-radius: 0;
  74. }
  75. /deep/.el-carousel__arrow--right {
  76. right: 16px;
  77. width: 35px;
  78. height: 57px;
  79. color: #616358;
  80. background: #dcdedc;
  81. position: absolute;
  82. right: 0;
  83. border: none;
  84. border-radius: 0;
  85. }
  86. /deep/ .el-carousel__indicators {
  87. // 指示器
  88. left: unset;
  89. transform: unset;
  90. right: 10px;
  91. bottom: 11px;
  92. }
  93. /deep/ .el-carousel__button {
  94. // 指示器按钮
  95. width: 10px;
  96. height: 10px;
  97. border: none;
  98. border-radius: 5px;
  99. background: #ccc;
  100. opacity: 1;
  101. }
  102. /deep/ .is-active .el-carousel__button {
  103. // 指示器激活按钮
  104. background: #fff;
  105. width: 58px;
  106. opacity: 1;
  107. }
  108. /deep/ .el-carousel__container {
  109. height: 100%;
  110. }
  111. }
  112. .custom-indicator button {
  113. background-color: #fff;
  114. opacity: 1;
  115. width: 8px;
  116. height: 8px;
  117. }
  118. .custom-indicator button.is-active {
  119. background-color: #DD7D18;
  120. width: 58px;
  121. opacity: 1;
  122. }
  123. </style>