imgCardLv1.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <div class="mta-card-lv1">
  3. <div class="mta-card-content-pc mta-hidden-xs" :class="[img.order>contentOrder ? 'img-left': 'img-right']">
  4. <img :style="`order:${img.order}`" :src="img.url">
  5. <div class="card-info" :style="`order: ${contentOrder}`">
  6. <h5>{{title}}</h5>
  7. <p class="card-des">{{description}}</p>
  8. <div class="mta-card-row" v-for="(rowList,index) in tagesPc" :key="`pc-${index}`">
  9. <template v-for="(des,ind) in rowList">
  10. <!-- 站位div -->
  11. <span v-if="des.empty" :key="ind"></span>
  12. <span v-else class="mta-card-row-item" :key="ind"><i></i><span>{{des.value}}</span></span>
  13. </template>
  14. </div>
  15. </div>s
  16. </div>
  17. <div class="mta-card-content-h5 mta-hidden-sm">
  18. <img :src="img">
  19. <div class="card-info">
  20. <h5>{{title}}</h5>
  21. <p>{{description}}</p>
  22. <div class="mta-card-row" v-for="(rowList,index) in tagesH5" :key="`pc-${index}`">
  23. <template v-for="(des,ind) in rowList">
  24. <!-- 站位div -->
  25. <span v-if="des.empty" :key="ind"></span>
  26. <span :key="ind"><i></i><span>{{des.value}}</span></span>
  27. </template>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. export default {
  35. name: "imgCardLv1",
  36. props: {
  37. option: {
  38. type: Object,
  39. required: true,
  40. },
  41. colPc: {
  42. type: Number,
  43. default: 3
  44. },
  45. colH5: {
  46. type: Number,
  47. default: 3
  48. }
  49. },
  50. computed: {
  51. img() {
  52. return {url: this.option.img.url, order: this.option.img.order}
  53. },
  54. title() {
  55. return this.option.content.title;
  56. },
  57. description() {
  58. return this.option.content.des;
  59. },
  60. contentOrder() {
  61. return this.option.content.order;
  62. },
  63. tagesPc() {
  64. const count = this.colPc;
  65. const list = this.option.content.list;
  66. const row = Math.ceil(list.length / count);
  67. const result = [];
  68. for (let i = 1; i <= row; i++) {
  69. const start = (i - 1) * count;
  70. const end = (i * count)
  71. const curList = list.slice(start, end);
  72. if (curList.length < count) {
  73. curList.push({type: 'empty'});
  74. }
  75. result.push(curList)
  76. }
  77. return result;
  78. },
  79. tagesH5() {
  80. const count = this.colH5;
  81. const list = this.option.content.list;
  82. const row = Math.ceil(list.length / count);
  83. const result = [];
  84. for (let i = 1; i <= row; i++) {
  85. const start = (i - 1) * count;
  86. const end = (i * count)
  87. const curList = list.slice(start, end);
  88. if (curList.length < count) {
  89. curList.push({type: 'empty'});
  90. }
  91. result.push(curList)
  92. }
  93. return result;
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. .mta-card-lv1 {
  100. .mta-card-content-pc {
  101. display: flex;
  102. }
  103. .img-left {
  104. img {
  105. margin-left: 100px;
  106. }
  107. }
  108. .img-right {
  109. img {
  110. margin-right: 100px;
  111. }
  112. }
  113. .card-info {
  114. h5 {
  115. font-size: 24px;
  116. font-weight: 800;
  117. text-align: left;
  118. color: #333;
  119. margin-top: 40px;
  120. margin-bottom: 30px;
  121. }
  122. .card-des {
  123. font-size: 14px;
  124. color: #333;
  125. font-weight: 500;
  126. text-align: left;
  127. }
  128. }
  129. .mta-card-row-item {
  130. font-size: 14px;
  131. font-weight: 500;
  132. color: #333;
  133. i {
  134. display: inline-block;
  135. width:13px;
  136. height: 13px;
  137. background: #00b96b;
  138. margin-right: 13px;
  139. }
  140. }
  141. }
  142. </style>