ImageTitleBlock.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div class="ImageTitleBlock" :style="{ backgroundImage: `url('${image}')` }">
  3. <div class="desc">
  4. <h5>{{ title }}</h5>
  5. <p>{{ desc }}</p>
  6. </div>
  7. </div>
  8. </template>
  9. <script setup lang="ts">
  10. defineProps({
  11. title: {
  12. type: String,
  13. default: ''
  14. },
  15. desc: {
  16. type: String,
  17. default: '' ,
  18. },
  19. image: {
  20. type: String,
  21. default: ''
  22. },
  23. })
  24. </script>
  25. <style lang="scss">
  26. @use '@/assets/scss/colors.scss' as *;
  27. .ImageTitleBlock {
  28. position: relative;
  29. padding: 24px;
  30. background-color: $box-color;
  31. background-size: cover;
  32. background-position: center;
  33. width: 400px;
  34. height: 270px;
  35. margin-right: 24px;
  36. &::before {
  37. content: '';
  38. display: block;
  39. position: absolute;
  40. right: 0;
  41. left: 0;
  42. bottom: 0;
  43. height: 120px;
  44. background: linear-gradient(
  45. 180deg,
  46. rgba(#000, 0) 0%,
  47. rgba(#000, 0.7) 100%
  48. )
  49. }
  50. .desc {
  51. position: absolute;
  52. right: 0;
  53. left: 0;
  54. bottom: 0;
  55. display: flex;
  56. flex-direction: column;
  57. padding: 24px;
  58. color: #fff;
  59. h5 {
  60. font-family: SourceHanSerifCNBold;
  61. font-size: 1.1rem;
  62. margin-bottom: 5px;
  63. }
  64. p {
  65. font-size: 0.8rem;
  66. margin: 0;
  67. }
  68. }
  69. }
  70. </style>