second-one.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. })
  20. "
  21. >
  22. <image class="goods-img" :src="item.picUrl" mode="aspectFill" />
  23. <view class="ss-p-10">
  24. <view class="goods-title ss-line-1">{{ item.name }}</view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script setup>
  31. import sheep from '@/sheep';
  32. const props = defineProps({
  33. data: {
  34. type: Object,
  35. default: () => ({}),
  36. },
  37. activeMenu: [Number, String],
  38. });
  39. </script>
  40. <style lang="scss" scoped>
  41. .title-box {
  42. .title-line-left,
  43. .title-line-right {
  44. width: 15px;
  45. height: 1px;
  46. background: #d2d2d2;
  47. }
  48. }
  49. .goods-item {
  50. width: calc((100% - 20px) / 3);
  51. margin-right: 10px;
  52. margin-bottom: 10px;
  53. &:nth-of-type(3n) {
  54. margin-right: 0;
  55. }
  56. .goods-img {
  57. width: calc((100vw - 140px) / 3);
  58. height: calc((100vw - 140px) / 3);
  59. }
  60. .goods-title {
  61. font-size: 26rpx;
  62. font-weight: bold;
  63. color: #333333;
  64. line-height: 40rpx;
  65. text-align: center;
  66. }
  67. .goods-price {
  68. color: $red;
  69. line-height: 40rpx;
  70. }
  71. }
  72. </style>