goods-temlate02.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <!-- 商品列表模板2样式 -->
  2. <template>
  3. <div class="goods-temlate02 good-list-cell" @click.stop="clickItem">
  4. <div class="good-img">
  5. <img v-lazy="thumb">
  6. <div class="video-overlay" v-if="videoIcon">
  7. <!-- 视频播放按钮样式 -->
  8. <div class="triangle-right"></div>
  9. </div>
  10. </div>
  11. <div class="good-content">
  12. <!-- 标题 -->
  13. <div class="good-title text-overflow-2">{{title}}</div>
  14. <!-- 价格和标签 -->
  15. <div class="good-price" ><div class="limitTime-tag" v-if="goodType == 'limitTime'">限时购</div> ¥{{price}}</div>
  16. <div class="countDown-box">
  17. <!-- 倒计时 -->
  18. <slot name="countDown"></slot>
  19. </div>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. export default {
  25. props: {
  26. thumb: {
  27. type: String,
  28. default: ""
  29. },
  30. title: {
  31. type: String,
  32. default: ""
  33. },
  34. price: {
  35. type: [String,Number],
  36. default: ""
  37. },
  38. time: {
  39. type: [String,Number],
  40. default: null
  41. },
  42. goodType: {
  43. type: String,
  44. default: "goods"
  45. },
  46. videoIcon: {
  47. type: Boolean,
  48. default: false
  49. },
  50. },
  51. data () {
  52. return {
  53. };
  54. },
  55. activated() {},
  56. components: {},
  57. computed: {},
  58. mounted() {},
  59. methods: {
  60. clickItem() {
  61. this.$emit("click")
  62. },
  63. }
  64. }
  65. </script>
  66. <style lang='scss' rel='stylesheet/scss' scoped>
  67. .good-list-cell{
  68. width: 220px;
  69. padding: 20px 20px 15px;
  70. display: flex;
  71. flex-direction: column;
  72. border: 1px solid #f4f4f4;
  73. background: #fff;
  74. box-sizing: border-box;
  75. border-radius: 5px;
  76. margin-bottom: 10px;
  77. .good-img{
  78. width: 180px;
  79. height: 180px;
  80. background-color: #262626;
  81. border-radius: 5px;
  82. position: relative;
  83. overflow: hidden;
  84. img{
  85. width: 100%;
  86. height: 100%;
  87. }
  88. .video-overlay{
  89. position: absolute;
  90. width: 100%;
  91. height: 100%;
  92. background-color: rgba(38, 38, 38, 0.5);
  93. top: 0;
  94. left: 0;
  95. display: flex;
  96. align-items: center;
  97. justify-content: center;
  98. .triangle-right {
  99. width: 0;
  100. height: 0;
  101. border-top: 15px solid transparent;
  102. border-left: 30px solid #fff;
  103. border-bottom: 15px solid transparent;
  104. }
  105. }
  106. }
  107. .good-content{
  108. .good-title,.good-price{
  109. line-height: 20px;
  110. font-size: 16px;
  111. padding-top: 14px;
  112. color: #000000;
  113. font-weight: bold;
  114. /*overflow: hidden;!*超出部分隐藏*!*/
  115. /*text-overflow:ellipsis;!* 超出部分显示省略号 *!*/
  116. /*white-space: nowrap;!*规定段落中的文本不进行换行 *!*/
  117. }
  118. .good-price{
  119. color: #ff0000;
  120. display: flex;
  121. .limitTime-tag{
  122. height: 20px;
  123. padding: 0 6px;
  124. position: relative;
  125. color: #fff;
  126. text-decoration: none;
  127. z-index: 1;
  128. font-size: 14px;
  129. margin:0 6px;
  130. }
  131. .limitTime-tag::before {
  132. content: '';
  133. position: absolute;
  134. top: 0;
  135. right: 0;
  136. bottom: 0;
  137. left: 0;
  138. z-index: -1;
  139. background: #ff0000;
  140. transform: skewX(-20deg);
  141. }
  142. }
  143. }
  144. &:hover{
  145. cursor:pointer;
  146. box-shadow: 0px 0px 27px 0px rgba(4, 0, 0, 0.2);
  147. img {
  148. transform: scale(1.04);
  149. transition: all 0.5s ease;
  150. }
  151. }
  152. }
  153. </style>