infoBox.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <n-card class="info-box">
  3. <template #cover>
  4. <div class="cover">
  5. <img :src="cover" />
  6. </div>
  7. </template>
  8. <div class="info-line">
  9. <div class="title">{{ title }}</div>
  10. <div class="time-line">
  11. <span> {{ time }}</span>
  12. <div class="see-more" @click="$router.push(`/info-detail/${id}`)">
  13. 查看
  14. <img class="see-more-img" src="@/assets/see_more.png" alt="see more" />
  15. </div>
  16. </div>
  17. </div>
  18. </n-card>
  19. </template>
  20. <script setup>
  21. defineOptions({
  22. name: "info-box",
  23. });
  24. defineProps({
  25. id: {
  26. type: [Number, String],
  27. default: () => NaN,
  28. },
  29. title: {
  30. type: [String, undefined],
  31. default: () => "",
  32. },
  33. cover: {
  34. type: [String, undefined],
  35. default: () => "",
  36. },
  37. time: {
  38. type: [String, undefined],
  39. default: () => "",
  40. },
  41. });
  42. </script>
  43. <style>
  44. .info-box {
  45. --box-remark-color: #9b9b9b;
  46. }
  47. </style>
  48. <style lang="scss" scoped>
  49. .n-card.info-box {
  50. padding: .625rem;
  51. --n-padding-left: 0 !important;
  52. --n-padding-bottom: 0 !important;
  53. // width: 32.1875rem;
  54. // height: 26.5rem;
  55. background: #f5f5f5;
  56. box-shadow: 0rem .125rem .25rem 0rem rgba(46,25,16,0.16);
  57. border-radius: .8125rem;
  58. border-top: .5rem solid var(--main-primary-color);
  59. .cover {
  60. background-color: gray;
  61. overflow: hidden;
  62. max-height: 17.75rem;
  63. }
  64. .title {
  65. font-size: 1.625rem;
  66. margin: .9375rem 0;
  67. }
  68. .info-line {
  69. display: flex;
  70. flex-direction: column;
  71. .time-line {
  72. width: 100%;
  73. flex: 1;
  74. display: flex;
  75. justify-content: space-between;
  76. color: var(--box-remark-color);
  77. font-size: 1rem;
  78. .see-more {
  79. cursor: pointer;
  80. display: inline-flex;
  81. justify-content: center;
  82. align-items: center;
  83. img {
  84. max-height: 1rem;
  85. width: auto;
  86. margin-left: .3125rem;
  87. }
  88. }
  89. }
  90. }
  91. }
  92. </style>