SliderCenter.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <div class="video-slider-center">
  3. <nuxt-link class="video-slider-title" :to="categoryLink">
  4. <div class="video-slider-title-text">
  5. {{ videoCategory.category.name }}
  6. </div>
  7. <div class="video-slider-title-link">
  8. <div class="button button_video-transparent">
  9. <BaseIcon name="play" />
  10. </div>
  11. </div>
  12. </nuxt-link>
  13. <div class="video-slider-items">
  14. <VueSlickCarousel v-bind="setting" v-if="videoCategory.news.length">
  15. <div
  16. class="video-slider-item-wrapper"
  17. v-for="item in videoCategory.news.slice(0, 5)"
  18. :key="item.id"
  19. >
  20. <nuxt-link class="video-slider-item" tag="div" :to="getLink(item)">
  21. <div class="item-image">
  22. <img :src="item.image.url" :alt="item.image.title" />
  23. </div>
  24. <div class="item-text" v-html="item.title"></div>
  25. </nuxt-link>
  26. </div>
  27. <template #prevArrow="arrowOption">
  28. <button class="video-slider-control video-slider-control-prev">
  29. <BaseIcon name="h-slider-prev" clear />
  30. </button>
  31. </template>
  32. <template #nextArrow="arrowOption">
  33. <button class="video-slider-control video-slider-control-next">
  34. <BaseIcon name="h-slider-next" clear />
  35. </button>
  36. </template>
  37. </VueSlickCarousel>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import VueSlickCarousel from "vue-slick-carousel";
  43. export default {
  44. components: {
  45. VueSlickCarousel,
  46. },
  47. props: {
  48. videoCategory: {
  49. type: Object,
  50. required: true,
  51. },
  52. },
  53. data: () => ({
  54. setting: {
  55. draggable: false,
  56. dots: true,
  57. arrows: true,
  58. variableWidth: true,
  59. },
  60. }),
  61. computed: {
  62. categoryLink() {
  63. return {
  64. name: "video-category",
  65. params: {
  66. category: this.videoCategory.category.alias,
  67. },
  68. };
  69. },
  70. },
  71. methods: {
  72. getLink(news) {
  73. return {
  74. name: "video-category-alias",
  75. params: {
  76. category: news.category.alias,
  77. alias: news.alias,
  78. },
  79. };
  80. },
  81. },
  82. };
  83. </script>
  84. <style lang="less" scoped>
  85. @paddingForShadow: 120px;
  86. @slideMargin: 15px;
  87. @controlSize: 45px;
  88. .video-slider {
  89. &-title {
  90. display: flex;
  91. align-items: center;
  92. cursor: pointer;
  93. &-text {
  94. color: #fff;
  95. font-size: 24px;
  96. font-weight: bold;
  97. }
  98. &-link {
  99. margin-left: 15px;
  100. }
  101. }
  102. &-items {
  103. margin-top: 28px;
  104. padding: 0 @slideMargin;
  105. }
  106. &-item-wrapper {
  107. padding-bottom: @paddingForShadow; //For box shadow with overflow: hidden
  108. }
  109. &-item {
  110. aspect-ratio: 863 / 486;
  111. position: relative;
  112. border-radius: 30px;
  113. transition: box-shadow 1s ease-in-out;
  114. box-shadow: none;
  115. display: flex;
  116. flex-direction: column;
  117. justify-content: flex-end;
  118. .slick-current & {
  119. box-shadow: 0px 24px 22px -18px rgba(255, 153, 0, 0.32),
  120. 0px 126px 98px -113px rgba(0, 255, 240, 0.4);
  121. }
  122. }
  123. &-control {
  124. width: @controlSize;
  125. height: @controlSize;
  126. background: rgba(255, 255, 255, 0.2);
  127. position: absolute;
  128. top: calc(50% - @paddingForShadow / 2);
  129. transform: translateY(-50%);
  130. border-radius: 50%;
  131. z-index: 1;
  132. .icon {
  133. fill: white;
  134. }
  135. &-prev {
  136. left: calc(0px - @controlSize / 2 - @slideMargin);
  137. }
  138. &-next {
  139. right: calc(0px - @controlSize / 2 - @slideMargin);
  140. }
  141. }
  142. @media screen and (max-width: 1300px) {
  143. &-control {
  144. &-prev {
  145. left: -@slideMargin;
  146. }
  147. &-next {
  148. right: -@slideMargin;
  149. }
  150. }
  151. }
  152. }
  153. ::v-deep .slick {
  154. &-slide {
  155. margin: 0 @slideMargin;
  156. width: 100%;
  157. max-width: 863px;
  158. }
  159. &-list {
  160. margin: 0 -@slideMargin;
  161. }
  162. &-dots {
  163. bottom: calc(@paddingForShadow - 28px);
  164. }
  165. @media screen and (max-width: 1300px) {
  166. &-slide {
  167. max-width: 80vw;
  168. }
  169. }
  170. }
  171. .item {
  172. &-image {
  173. z-index: 0;
  174. position: absolute;
  175. width: 100%;
  176. height: 100%;
  177. left: 0;
  178. top: 0;
  179. filter: brightness(80%);
  180. img {
  181. width: 100%;
  182. height: 100%;
  183. border-radius: 30px;
  184. object-fit: cover;
  185. }
  186. }
  187. &-text {
  188. position: relative;
  189. z-index: 1;
  190. font-size: 18px;
  191. line-height: 140%;
  192. padding: 50px;
  193. color: white;
  194. max-width: 454px;
  195. }
  196. @media screen and (max-width: 1300px) {
  197. &-text {
  198. padding: 20px 25px;
  199. font-size: 14px;
  200. }
  201. }
  202. }
  203. </style>