infoBox.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <n-card class="info-box">
  3. <template #cover>
  4. <img :src="cover" />
  5. </template>
  6. <!-- <div class="cover" :style="{ backgroundImage: `url(${cover})` }"></div> -->
  7. <div class="info-line">
  8. <div class="title">{{ title }}</div>
  9. <div class="time-line">
  10. <span> {{ time }}</span>
  11. <div class="see-more" @click="$router.push(`/info-detail/${id}`)">
  12. 查看
  13. </div>
  14. </div>
  15. </div>
  16. </n-card>
  17. </template>
  18. <script setup>
  19. defineOptions({
  20. name: "info-box",
  21. });
  22. defineProps({
  23. id: {
  24. type: [Number, String],
  25. default: () => NaN,
  26. },
  27. title: {
  28. type: [String, undefined],
  29. default: () => "",
  30. },
  31. cover: {
  32. type: [String, undefined],
  33. default: () => "",
  34. },
  35. time: {
  36. type: [String, undefined],
  37. default: () => "",
  38. },
  39. });
  40. </script>
  41. <style lang="scss" scoped>
  42. .n-card.info-box {
  43. padding: 10px;
  44. --n-padding-left: 0 !important;
  45. --n-padding-bottom: 0 !important;
  46. .cover {
  47. min-height: 250px;
  48. background-color: gray;
  49. }
  50. .title {
  51. font-size: 28px;
  52. }
  53. .info-line {
  54. display: flex;
  55. flex-direction: column;
  56. .time-line {
  57. width: 100%;
  58. flex: 1;
  59. display: flex;
  60. justify-content: space-between;
  61. .see-more {
  62. cursor: pointer;
  63. }
  64. }
  65. }
  66. }
  67. </style>