app-diy-composition-image.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view class="app-diy-composition-image">
  3. <view class="goods-one dir-left-wrap" :class="imageClass">
  4. <block v-for="(item,key) in imageList" :key="key">
  5. <image :mode="mode" :src="item"></image>
  6. </block>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. name: "app-diy-composition-image",
  13. props: {
  14. imageList: Array,
  15. mode: String,
  16. },
  17. computed: {
  18. imageClass() {
  19. let count = this.imageList.length;
  20. switch (count) {
  21. case 1:
  22. return 'goods-one';
  23. case 2:
  24. return 'goods-two';
  25. case 3:
  26. return 'goods-three';
  27. case 4:
  28. return 'goods-four';
  29. case 5:
  30. return 'goods-five';
  31. }
  32. },
  33. },
  34. }
  35. </script>
  36. <style scoped lang="scss">
  37. .app-diy-composition-image {
  38. height: 100%;
  39. width: 100%;
  40. position: relative;
  41. overflow: hidden;
  42. .plugin-text-class {
  43. position: absolute;
  44. z-index: 11;
  45. }
  46. .plugin-image-class {
  47. position: absolute;
  48. z-index: 10;
  49. image {
  50. height: 100%;
  51. width: 100%;
  52. }
  53. }
  54. image {
  55. display: block;
  56. }
  57. .goods-one {
  58. height: 100%;
  59. width: 100%;
  60. image {
  61. height: 100%;
  62. width: 100%;
  63. }
  64. }
  65. .goods-two {
  66. height: 100%;
  67. width: 100%;
  68. image:nth-child(1) {
  69. position: absolute;
  70. top: 0;
  71. left: 0;
  72. height: 100%;
  73. width: 48.8%;
  74. }
  75. image:nth-child(2) {
  76. position: absolute;
  77. top: 0;
  78. right: 0;
  79. height: 100%;
  80. width: 48.8%;
  81. }
  82. }
  83. .goods-three {
  84. height: 100%;
  85. width: 100%;
  86. image:nth-child(1) {
  87. position: absolute;
  88. top: 0;
  89. left: 0;
  90. height: 100%;
  91. width: 48.8%;
  92. }
  93. image:nth-child(2) {
  94. position: absolute;
  95. top: 0;
  96. right: 0;
  97. height: 48.8%;
  98. width: 48.8%;
  99. }
  100. image:nth-child(3) {
  101. position: absolute;
  102. bottom: 0;
  103. right: 0;
  104. height: 48.8%;
  105. width: 48.8%;
  106. }
  107. }
  108. .goods-four {
  109. height: 100%;
  110. width: 100%;
  111. image:nth-child(1) {
  112. position: absolute;
  113. top: 0;
  114. left: 0;
  115. height: 100%;
  116. width: 48.8%;
  117. }
  118. image:nth-child(2) {
  119. position: absolute;
  120. top: 0;
  121. right: 0;
  122. height: 48.8%;
  123. width: 48.8%;
  124. }
  125. image:nth-child(3) {
  126. position: absolute;
  127. bottom: 0;
  128. left: calc(50% + 4rpx);
  129. height: 48.8%;
  130. width: calc(24.4% - 4rpx);
  131. }
  132. image:nth-child(4) {
  133. position: absolute;
  134. bottom: 0;
  135. right: 0;
  136. height: 48.8%;
  137. width: calc(24.4% - 4rpx);
  138. }
  139. }
  140. .goods-five {
  141. height: 100%;
  142. width: 100%;
  143. position: relative;
  144. image:nth-child(1) {
  145. position: absolute;
  146. top: 0;
  147. left: 0;
  148. height: 100%;
  149. width: 48.8%;
  150. }
  151. image:nth-child(2) {
  152. position: absolute;
  153. top: 0;
  154. left: calc(50% + 4rpx);
  155. height: 48.8%;
  156. width: calc(24.4% - 4rpx);
  157. }
  158. image:nth-child(3) {
  159. position: absolute;
  160. top: 0;
  161. right: 0;
  162. height: 48.8%;
  163. width: calc(24.4% - 4rpx);
  164. }
  165. image:nth-child(4) {
  166. position: absolute;
  167. bottom: 0;
  168. left: calc(50% + 4rpx);
  169. height: 48.8%;
  170. width: calc(24.4% - 4rpx);
  171. }
  172. image:nth-child(5) {
  173. position: absolute;
  174. bottom: 0;
  175. right: 0;
  176. height: 48.8%;
  177. width: calc(24.4% - 4rpx);
  178. }
  179. }
  180. }
  181. </style>