imageTextList.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <div class="hom-pro-list warp" :class="'terminal'+terminal">
  3. <div class="title">
  4. <h2 class="h2" :style="{textAlign:componentContent.textAlign}">{{componentContent.title}}</h2>
  5. </div>
  6. <ul class="clearfix" :class="{imgTextNum4: componentContent.imgTextData.length === 4, imgTextNum5: componentContent.imgTextData.length === 5, imgTextStyle: componentContent.imgTextData.length >= 6 || componentContent.imgTextData.length === 3}">
  7. <li v-for="(item,index) in componentContent.imgTextData" :key="index">
  8. <a class="item a-link" @click="jumpLink(componentContent.linkObj)">
  9. <div class="itemImgBox" v-show="item.isShow">
  10. <div class="imgBox">
  11. <img ref="getHeight" :src="item.imgData" v-show="item.imgData" :alt="item.title">
  12. </div>
  13. </div>
  14. <div class="text">
  15. <h4 class="h4">{{item.title}}</h4>
  16. <p class="p">{{item.describe}}</p>
  17. </div>
  18. </a>
  19. </li>
  20. </ul>
  21. </div>
  22. </template>
  23. <script>
  24. import {funMixin} from '../config/mixin'
  25. export default {
  26. name: 'imageTextList',
  27. mixins: [funMixin],
  28. props: {
  29. terminal: {
  30. type: Number,
  31. default: 4
  32. },
  33. componentContent: {
  34. type: Object
  35. }
  36. }
  37. }
  38. </script>
  39. <style lang="scss" scoped>
  40. .hom-pro-list{
  41. min-height: 450px;
  42. padding: 20px 0;
  43. .title{
  44. margin-bottom: 23px;
  45. position: relative;
  46. .h2{
  47. font-size: 22px;
  48. color: #333;
  49. line-height: 1em;
  50. font-weight: bold;
  51. }
  52. }
  53. ul{
  54. margin: -15px 0 0 -15px;
  55. display: flex;
  56. flex-wrap: wrap;
  57. li{
  58. flex: 0 0 50%;
  59. padding: 15px 0 0 15px;
  60. box-sizing: border-box;
  61. .item{
  62. .itemImgBox {
  63. height: auto;
  64. display: flex;
  65. flex-direction: column;
  66. justify-content: center;
  67. .imgBox {
  68. padding-bottom: 80%;
  69. background-color: #cacaca;
  70. position: relative;
  71. img {
  72. max-width: 100%;
  73. height: 100%;
  74. max-height: 100%;
  75. position: absolute;
  76. margin: auto;
  77. top: 0;
  78. right: 0;
  79. bottom: 0;
  80. left: 0;
  81. }
  82. }
  83. }
  84. .text{
  85. padding:16px 20px;
  86. text-align: center;
  87. .h4{
  88. line-height: 25px;
  89. overflow: hidden;
  90. color: #333333;
  91. }
  92. .p{
  93. color: #666666;
  94. padding: 5px 0 10px;
  95. }
  96. }
  97. }
  98. }
  99. }
  100. .imgTextNum4 {
  101. li {
  102. flex: 0 0 50%;
  103. }
  104. }
  105. .imgTextNum5 {
  106. li {
  107. flex: 0 0 33.33%;
  108. }
  109. li:nth-child(1) {
  110. flex: 0 0 50%;
  111. }
  112. li:nth-child(2) {
  113. flex: 0 0 50%;
  114. }
  115. }
  116. .imgTextStyle {
  117. li {
  118. flex: 0 0 33.33%;
  119. }
  120. }
  121. }
  122. @media screen and (max-width: 768px) {
  123. .hom-pro-list ul li{
  124. flex: 0 0 50%;
  125. }
  126. }
  127. .terminal1,.terminal2,.terminal3{
  128. &.hom-pro-list ul li{
  129. flex: 0 0 50%;
  130. }
  131. }
  132. </style>