second-one.vue 2.1 KB

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