1.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <div class="swiperStyle1">
  3. <el-carousel :interval="3000" height="405px" indicator-position="none" arrow="always" @change="change_fun">
  4. <el-carousel-item v-for="(item, index) in imagelist" :key="item">
  5. <NuxtLink
  6. :to="`/${item.pinyin}/${item.id}.html`"
  7. class="swiper_link"
  8. :target="item.islink == 1 ? '_blank' : '_self'"
  9. >
  10. <img :src="item.imgurl">
  11. <span class="swiper_dot1 dot1">
  12. {{ item.title }}
  13. </span>
  14. </NuxtLink>
  15. </el-carousel-item>
  16. </el-carousel>
  17. <div class="roll_num_box">
  18. <span class="roll_num_box_new">{{ roll_num_this + 1 }}</span>
  19. /
  20. {{ roll_num_lang }}
  21. </div>
  22. </div>
  23. </template>
  24. <script setup>
  25. //引入vue
  26. import { ref } from 'vue'
  27. import { ElCarousel, ElCarouselItem } from 'element-plus'
  28. //获得新闻数据
  29. const props = defineProps({
  30. skinId:String,//皮肤编号
  31. templateData:Array,//新闻数据
  32. });
  33. //焦点图效果 start---------------------------------------->
  34. const roll_num_lang = ref(4);
  35. const roll_num_this = ref(0);
  36. const change_fun = (the_1) => {
  37. roll_num_this.value = the_1
  38. }
  39. const imagelist = ref("")
  40. imagelist.value = props.templateData;
  41. roll_num_lang.value = props.templateData.length - 1;
  42. //焦点图效果 end---------------------------------------->
  43. </script>
  44. <style lang="less" scoped>
  45. //样式1 start---------------------------------------->
  46. .swiperStyle1 {
  47. width: 100%;
  48. height: 405px;
  49. position: relative;
  50. .roll_num_box {
  51. position: absolute;
  52. z-index: 100;
  53. left: 60px;
  54. bottom: 0px;
  55. height: 60px;
  56. line-height: 60px;
  57. color: #fff;
  58. font-size: 16px;
  59. .roll_num_box_new {
  60. font-size: 20px;
  61. }
  62. }
  63. .dot1 {
  64. display: block;
  65. word-break: keep-all;
  66. white-space: nowrap;
  67. overflow: hidden;
  68. text-overflow: ellipsis;
  69. }
  70. img {
  71. width: 100%;
  72. height: 405px;
  73. }
  74. .swiper_dot1 {
  75. display: block;
  76. width: 100%;
  77. line-height: 60px;
  78. height: 60px;
  79. color: #fff;
  80. font-size: 18px;
  81. text-indent: 20px;
  82. position: absolute;
  83. bottom: 0;
  84. left: 0;
  85. z-index: 10;
  86. box-sizing: border-box;
  87. padding: 0 144px;
  88. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  89. }
  90. .el-carousel {
  91. /deep/.el-carousel__arrow i {
  92. font-size: 33px !important;
  93. }
  94. .roll_1_box {
  95. position: relative;
  96. }
  97. /deep/.el-carousel__arrow--left {
  98. position: absolute;
  99. width: 35px;
  100. height: 57px;
  101. color: #fff;
  102. background: rgba(0, 0, 0, 0);
  103. left: 9px;
  104. border: none;
  105. border-radius: 0;
  106. top: 100%;
  107. margin-top: -28px;
  108. }
  109. /deep/.el-carousel__arrow--right {
  110. width: 35px;
  111. height: 57px;
  112. color: #fff;
  113. background: rgba(0, 0, 0, 0);
  114. position: absolute;
  115. right: 9;
  116. border: none;
  117. border-radius: 0;
  118. top: 100%;
  119. margin-top: -28px;
  120. }
  121. /deep/ .el-carousel__indicators {
  122. // 指示器
  123. left: unset;
  124. transform: unset;
  125. right: 10px;
  126. bottom: 11px;
  127. }
  128. /deep/ .el-carousel__button {
  129. // 指示器按钮
  130. width: 10px;
  131. height: 10px;
  132. border: none;
  133. border-radius: 5px;
  134. background: #fff;
  135. opacity: 1;
  136. }
  137. /deep/ .is-active .el-carousel__button {
  138. // 指示器激活按钮
  139. background: #255590;
  140. width: 25px;
  141. opacity: 1;
  142. }
  143. /deep/ .el-carousel__container {
  144. height: 100%;
  145. }
  146. }
  147. .custom-indicator button {
  148. background-color: #fff;
  149. opacity: 1;
  150. width: 8px;
  151. height: 8px;
  152. }
  153. .custom-indicator button.is-active {
  154. background-color: #DD7D18;
  155. width: 58px;
  156. opacity: 1;
  157. }
  158. }
  159. //样式1 end---------------------------------------->
  160. </style>