bookshelf-readHistory.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view class="readHistory_content" :style="{width:window_width}">
  3. <view class="" @click="clickDeleteBook">
  4. 清空
  5. </view>
  6. <view class="book-list">
  7. <view class="book-list__item" v-for="(item,index) in book_list" :key="index"
  8. @click="clickBook(item,index)">
  9. <view class="book-list__item__book-cover">
  10. <image class="image" :src="item.book_cover" mode="aspectFill"></image>
  11. </view>
  12. <view class="book-list__item__book-info">
  13. <view class="book-list__item__book-info__name">
  14. {{item.book_name}}
  15. </view>
  16. <view class="book-list__item__book-info__author book-list__item__book-info__name">
  17. 作者:{{item.author_name}}
  18. </view>
  19. <view class="book-list__item__book-info__date book-list__item__book-info__name">
  20. {{item.read_hisroty_time}}
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script setup lang="ts">
  28. import { ref } from 'vue';
  29. import { book_item_data } from '../../data/data';
  30. defineProps({
  31. book_list: Array<book_item_data>,
  32. })
  33. const emits = defineEmits(['clickBook','clickDeleteBook'])
  34. let window_width = ref(uni.getSystemInfoSync().windowWidth + 'px')
  35. function clickDeleteBook() {
  36. emits('clickDeleteBook')
  37. }
  38. function clickBook(book_data:book_item_data, index:number) {
  39. emits('clickBook',book_data,index)
  40. }
  41. </script>
  42. <style lang="scss">
  43. .readHistory_content{
  44. display: flex;
  45. flex-direction: column;
  46. // background-color: purple;
  47. .book-list{
  48. display: flex;
  49. flex-direction: column;
  50. margin-top: 20rpx;
  51. // background-color: red;
  52. &__item{
  53. display: flex;
  54. flex-direction: row;
  55. margin-bottom: 20rpx;
  56. padding: 0 20rpx;
  57. // background-color: green;
  58. &__book-cover{
  59. width: 200rpx;
  60. height: 250rpx;
  61. flex-shrink: 0; //设置flex元素所有比例.默认是1,为0的时候不进行缩放
  62. .image {
  63. width: 100%;
  64. height: 100%;
  65. }
  66. }
  67. &__book-info{
  68. display: flex;
  69. flex-direction: column;
  70. margin-left: 20rpx;
  71. // background-color: red;
  72. &__name{
  73. margin-top: 10rpx;
  74. display: -webkit-box;
  75. align-items: center;
  76. -webkit-line-clamp: 2;
  77. -webkit-box-orient: vertical;
  78. overflow: hidden;
  79. text-overflow: ellipsis;
  80. font-size: 20px;
  81. }
  82. &__author{
  83. margin-top: 20rpx;
  84. font-size: 16px;
  85. -webkit-line-clamp: 1;
  86. }
  87. &__date{
  88. margin-top: 20rpx;
  89. font-size: 15px;
  90. -webkit-line-clamp: 1;
  91. }
  92. }
  93. }
  94. }
  95. }
  96. </style>