shop.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <div class="shop" :class="'terminal' + terminal">
  3. <swiper :options="swiperOption">
  4. <swiper-slide class="shop-item" v-for="(item,index) in imgList" :key="index">
  5. <div class="shop-item-warp">
  6. <img class="img" :src="item.img">
  7. <div class="a-link" @click="jumpLink(item.linkObj)">
  8. 进店逛逛<i class="iconfont icon-arrow-right"></i>
  9. </div>
  10. </div>
  11. </swiper-slide>
  12. </swiper>
  13. <div class="pagination shop-pagination"></div>
  14. </div>
  15. </template>
  16. <script>
  17. import { directive, Swiper, SwiperSlide } from 'vue-awesome-swiper'
  18. import 'swiper/css/swiper.css'
  19. import {funMixin} from '../config/mixin'
  20. export default {
  21. name: 'shop',
  22. mixins: [funMixin],
  23. data () {
  24. return {
  25. swiperOption: {
  26. autoplay: false, // 可选选项,自动滑动
  27. loop: true,
  28. pagination: {
  29. el: '.shop-pagination'
  30. }
  31. }
  32. }
  33. },
  34. props: {
  35. terminal: {
  36. type: Number,
  37. default: 4
  38. },
  39. componentContent: {
  40. type: Object
  41. }
  42. },
  43. components: {
  44. Swiper,
  45. SwiperSlide
  46. },
  47. directives: {
  48. swiper: directive
  49. },
  50. computed: {
  51. imgList: function () {
  52. console.log(this.componentContent)
  53. return this.componentContent.imgTextData.filter(function (item) {
  54. return item.img
  55. })
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. .shop{
  62. position: relative;
  63. &-item{
  64. &-warp{
  65. position: relative;
  66. padding: 0 20px;
  67. .img{
  68. width: 100%;
  69. height: 420px;
  70. }
  71. .a-link{
  72. width: 220px;
  73. height: 80px;
  74. line-height: 80px;
  75. background: linear-gradient(225deg, #585858 0%, #333333 100%);
  76. box-shadow: 0px 20px 40px rgba(0, 0, 0, 0.3);
  77. display: block;
  78. color: #fff;
  79. font-size: 28px;
  80. text-align: center;
  81. position: absolute;
  82. right: 0;
  83. bottom: 30px;
  84. .icon{
  85. margin-left: 20px;
  86. }
  87. }
  88. }
  89. }
  90. .pagination{
  91. display: flex;
  92. justify-content: center;
  93. padding:20px 0;
  94. ::v-deep .swiper-pagination-bullet{
  95. width: 12px;
  96. height: 12px;
  97. background: #333333;
  98. border-radius: 50%;
  99. opacity: 0.2;
  100. margin: 0 10px;
  101. }
  102. ::v-deep .swiper-pagination-bullet-active{
  103. width: 24px;
  104. height: 12px;
  105. background: #333333;
  106. opacity: 1;
  107. border-radius: 8px;
  108. }
  109. }
  110. }
  111. </style>