Blame view

pc-master/src/views/product/components/likeList.vue 2.41 KB
3f535f30   杨鑫   '初始'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
  <template>
    <div class="likeList">
      <div class="likeProTit">
        <div class="likeListTit"><i></i><span>猜你喜欢</span><i></i></div>
        <span class="description">Guess you like it</span>
      </div>
      <div class="likeListBox">
        <div @click="goToProDetail(item)" class="likeProItem" v-for="(item) of similarProducts" :key="item.productId">
          <div class="itemImgBox">
            <div class="imgBox">
              <img ref="getHeight" :src="item.image">
            </div>
          </div>
          <div class="text">
            <h4 class="h4">{{item.productName}}</h4>
          </div>
        </div>
      </div>
    </div>
  </template>
  
  <script>
  export default {
    name: 'likeList',
    props: {
      similarProducts: Array
    },
    methods: {
      // 跳转到商品详情
      goToProDetail (item) {
        console.log(item)
        let data = {
          productId: item.productId,
          skuId: item.skuId,
          shopId: item.shopId
        }
        this.$router.push({
          path: '/productDetail',
          query: {
            proData: JSON.stringify(data)
          }
        })
        this.$emit('reloadDetail')
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
   .likeList {
     .likeProTit {
       text-align: center;
       margin-bottom: 40px;
       .likeListTit {
         width: 100%;
         display: flex;
         justify-content: center;
         height: 30px;
         align-items: center;
         i {
           width: 53px;
           height: 2px;
           background: #3f9b6a;
         }
         span {
           margin: 0 15px;
         }
       }
       .description {
         color: #666666;
         font-size: 12px;
       }
     }
     .likeListBox {
       .likeProItem {
         margin-bottom: 30px;
         cursor: pointer;
         .itemImgBox {
           height: auto;
           display: flex;
           flex-direction: column;
           justify-content: center;
           .imgBox {
             padding-bottom: 80%;
             background-color: #f1f1f1;
             position: relative;
             img {
               max-width: 100%;
               height: 100%;
               max-height: 100%;
               position: absolute;
               margin: auto;
               top: 0;
               right: 0;
               bottom: 0;
               left: 0;
             }
           }
         }
         .text {
           h4 {
             font-size: 16px;
             color: #333333;
             font-weight: 400;
             line-height: 35px;
             text-align: center;
           }
         }
       }
     }
   }
  </style>