cm-special.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="special" @click="activeProduct">
  3. <view class="img">
  4. <image :src="activeImage.image" mode="aspectFill" style="width: 100%;height: 100%;"></image>
  5. </view>
  6. <view class="special_title">
  7. <view class="title">
  8. {{activeImage.topic | subText(25)}}
  9. </view>
  10. <view class="">
  11. <button class="special_btn">查看详情</button>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. props: {
  19. activeImage: {
  20. type: Object,
  21. default: () => {}
  22. }
  23. },
  24. data() {
  25. return {}
  26. },
  27. filters: {
  28. subText(str, index) {
  29. if(str) {
  30. if (str.length <= index) {
  31. return str
  32. }
  33. return str.substring(0, index) + '...'
  34. }
  35. return str
  36. }
  37. },
  38. methods: {
  39. activeProduct() {
  40. uni.navigateTo({
  41. url: '/pages/goods/active-product?activeImageId=' + this.activeImage.id
  42. })
  43. },
  44. }
  45. }
  46. </script>
  47. <style lang="scss" scoped>
  48. .special {
  49. border-radius: 8rpx;
  50. margin-bottom: 24rpx;
  51. height: 432rpx;
  52. width: 100%;
  53. box-sizing: border-box;
  54. overflow: hidden;
  55. }
  56. .img {
  57. width: 100%;
  58. height: 360rpx;
  59. box-sizing: border-box;
  60. }
  61. .special_title {
  62. height: 72rpx;
  63. box-sizing: border-box;
  64. padding: 12rpx 24rpx;
  65. background-color: #FFF8EF;
  66. display: flex;
  67. justify-content: space-between;
  68. align-items: center;
  69. }
  70. .special_title .title {
  71. color: #F3B574;
  72. font-size: 26rpx;
  73. }
  74. .special_btn {
  75. border-radius: 8rpx;
  76. padding: 8rpx 16rpx;
  77. box-sizing: border-box;
  78. background-color: #F3B574;
  79. color: #FFFFFF;
  80. font-size: 24rpx;
  81. width: 128rpx;
  82. height: 48rpx;
  83. text-align: center;
  84. display: flex;
  85. align-items: center;
  86. }
  87. </style>