Card.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <a :href="detailUrl">
  3. <div class="book-card">
  4. <div class="thumb">
  5. <img
  6. :src="book.image"
  7. class="img"
  8. mode="aspectFit"
  9. @click.stop="preview"
  10. >
  11. </div>
  12. <div class="detail">
  13. <div class="row text-primary">
  14. <div class="right">
  15. {{book.rate}} <Rate :value="book.rate" />
  16. </div>
  17. <div class="left">
  18. {{book.title}}
  19. </div>
  20. </div>
  21. <div class="row">
  22. <div class="right text-primary">
  23. 浏览量: {{book.count}}
  24. </div>
  25. <div class="left">
  26. {{book.author}}
  27. </div>
  28. </div>
  29. <div class="row">
  30. <div class="right">
  31. <!-- 捐赠人 -->
  32. {{book.user_info.nickName}}
  33. </div>
  34. <div class="left">
  35. {{book.publisher}}
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </a>
  41. </template>
  42. <script>
  43. import Rate from '@/components/Rate';
  44. export default {
  45. components:{
  46. Rate
  47. },
  48. props: ['book'],
  49. computed: {
  50. detailUrl() {
  51. return '/pages/detail/main?id='+ this.book.id
  52. }
  53. },
  54. methods: {
  55. preview() {
  56. wx.previewImage({
  57. current: this.book.image,
  58. urls: [this.book.image]
  59. })
  60. }
  61. }
  62. }
  63. </script>
  64. <style lang='scss' scoped>
  65. .book-card{
  66. padding:5px;
  67. overflow: hidden;
  68. margin-top:5px;
  69. margin-bottom:5px;
  70. font-size:14px;
  71. .thumb{
  72. width:90px;
  73. height:90px;
  74. float: left;
  75. margin:0 auto;
  76. overflow:hidden;
  77. .img{
  78. max-width: 100%;
  79. max-height: 100%;
  80. }
  81. }
  82. .detail{
  83. margin-left: 100px;
  84. .row{
  85. line-height:20px;
  86. margin-bottom:3px;
  87. }
  88. .right{
  89. float: right;
  90. }
  91. .left{
  92. margin-right:80px;
  93. }
  94. }
  95. }
  96. </style>