1.vue 4.2 KB

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