second-one.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 class="goods-item" v-for="item in props.data[activeMenu].children" :key="item.id" @tap="
  13. sheep.$router.go('/pages/goods/list', {
  14. categoryId: item.id,
  15. })
  16. ">
  17. <image class="goods-img" :src="item.picUrl" mode="aspectFill" />
  18. <view class="ss-p-10">
  19. <view class="goods-title ss-line-1">{{ item.name }}</view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script setup>
  26. import sheep from '@/sheep';
  27. const props = defineProps({
  28. data: {
  29. type: Object,
  30. default: () => ({}),
  31. },
  32. activeMenu: [Number, String],
  33. });
  34. </script>
  35. <style lang="scss" scoped>
  36. .title-box {
  37. .title-line-left,
  38. .title-line-right {
  39. width: 15px;
  40. height: 1px;
  41. background: #d2d2d2;
  42. }
  43. }
  44. .goods-item {
  45. width: calc((100% - 50px) / 3);
  46. margin-right: 10px;
  47. margin-bottom: 10px;
  48. background: #eee;
  49. box-shadow: 0px 0px 20rpx 8rpx rgba(199, 199, 199, 0.22);
  50. border-radius: 20rpx;
  51. padding: 10rpx;
  52. &:nth-of-type(3n) {
  53. margin-right: 0;
  54. }
  55. .goods-img {
  56. width: calc((100vw - 180px) / 3);
  57. height: calc((100vw - 180px) / 3);
  58. border-radius: 20rpx;
  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>