多租户商城-商户小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
2.5 KiB

2 years ago
  1. <template>
  2. <div class="category-list warp" :class="'terminal' + terminal">
  3. <h2 class="hom-title" :style="{textAlign:componentContent.textAlign}">{{componentContent.title}}</h2>
  4. <div class="content-warp">
  5. <div class="ul clearfix" :class="{number5: componentContent.categoryData.length === 5}">
  6. <div class="li" v-for="(item) of componentContent.categoryData" :key="item.id">
  7. <a class="item a-link" @click="jumpCategory(item)">
  8. <div class="imgBox">
  9. <img ref="getHeight" :src="item.img" v-show="item.img" :alt="item.name">
  10. </div>
  11. </a>
  12. </div>
  13. </div>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import {funMixin} from '../config/mixin'
  19. export default {
  20. name: 'categoryList',
  21. mixins: [funMixin],
  22. props: {
  23. terminal: {
  24. type: Number,
  25. default: 4
  26. },
  27. componentContent: {
  28. type: Object
  29. }
  30. }
  31. }
  32. </script>
  33. <style lang="scss" scoped>
  34. .category-list{
  35. padding: 20upx 0;
  36. .hom-title{
  37. font-size: 22upx;
  38. color: #333;
  39. line-height: 1em;
  40. margin-bottom: 23upx;
  41. font-weight: bold;
  42. text-align: center;
  43. }
  44. .content-warp{
  45. display: flex;
  46. .ul{
  47. width: 100%;
  48. display: flex;
  49. flex-wrap: wrap;
  50. .li{
  51. flex: 1;
  52. padding: 10upx 0 0 10upx;
  53. box-sizing: border-box;
  54. .item{
  55. height: auto;
  56. display: flex;
  57. flex-direction: column;
  58. justify-content: center;
  59. .imgBox {
  60. padding-bottom: 80%;
  61. background-color: #cacaca;
  62. position: relative;
  63. }
  64. img {
  65. max-width: 100%;
  66. height: 100%;
  67. max-height: 100%;
  68. position: absolute;
  69. margin: auto;
  70. top: 0;
  71. right: 0;
  72. bottom: 0;
  73. left: 0;
  74. }
  75. }
  76. }
  77. }
  78. .number5 {
  79. display: block;
  80. .li {
  81. width: 25%;
  82. float: left;
  83. }
  84. .li:nth-child(1) {
  85. width: 50%;
  86. }
  87. }
  88. }
  89. }
  90. @media screen and (max-width: 768px) {
  91. .category-list .content-warp .ul .li{
  92. flex: 0 0 50%;
  93. }
  94. }
  95. .terminal1,.terminal2,.terminal3{
  96. &.category-list .content-warp{
  97. display: block;
  98. .ul{
  99. margin: -15upx 0 0 -15upx;
  100. width: auto;
  101. .li{
  102. flex: 0 0 50%;
  103. padding: 15upx 0 0 15upx;
  104. }
  105. }
  106. }
  107. }
  108. </style>