second-one.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <!-- 分类展示:second-one 风格 -->
  2. <template>
  3. <view>
  4. <!-- 一级分类的名字 -->
  5. <view class="title-box ss-flex ss-col-center ss-row-center ss-p-b-30">
  6. <view class="title-line-left" />
  7. <view class="title-text ss-p-x-20">{{ props.data[activeMenu].name }}</view>
  8. <view class="title-line-right" />
  9. </view>
  10. <!-- 二级分类的名字 -->
  11. <view class="goods-item-box ss-flex ss-flex-wrap ss-p-b-20">
  12. <view
  13. class="goods-item"
  14. v-for="item in props.data[activeMenu].children"
  15. :key="item.id"
  16. @tap="
  17. sheep.$router.go('/pages/goods/list', {
  18. categoryId: item.id,
  19. shopId,
  20. merchantId,
  21. })
  22. "
  23. >
  24. <image class="goods-img" :src="item.picUrl" mode="aspectFill" />
  25. <view class="ss-p-10">
  26. <view class="goods-title ss-line-1">{{ item.name }}</view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script setup>
  33. import sheep from '@/sheep';
  34. const props = defineProps({
  35. data: {
  36. type: Object,
  37. default: () => ({}),
  38. },
  39. activeMenu: [Number, String],
  40. shopId:{
  41. type: String,
  42. },
  43. merchantId:{
  44. type: String,
  45. },
  46. });
  47. </script>
  48. <style lang="scss" scoped>
  49. .title-box {
  50. .title-line-left,
  51. .title-line-right {
  52. width: 15px;
  53. height: 1px;
  54. background: #d2d2d2;
  55. }
  56. }
  57. .goods-item {
  58. width: calc((100% - 20px) / 3);
  59. margin-right: 10px;
  60. margin-bottom: 10px;
  61. &:nth-of-type(3n) {
  62. margin-right: 0;
  63. }
  64. .goods-img {
  65. width: calc((100vw - 140px) / 3);
  66. height: calc((100vw - 140px) / 3);
  67. }
  68. .goods-title {
  69. font-size: 26rpx;
  70. font-weight: bold;
  71. color: #333333;
  72. line-height: 40rpx;
  73. text-align: center;
  74. }
  75. .goods-price {
  76. color: $red;
  77. line-height: 40rpx;
  78. }
  79. }
  80. </style>