SmallSwiper1.vue 3.1 KB

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