banner.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <div class="common-banner" :style="{'height': height + 'px'}">
  3. <img class="bg-img" :src="img" :style="{'height': height + 'px', 'max-height': height + 'px'}" alt="" srcset="">
  4. <!-- <img class="bg-img" :src="img" alt="" srcset=""> -->
  5. <div class="bg-content">
  6. <slot></slot>
  7. </div>
  8. </div>
  9. </template>
  10. <script>
  11. export default {
  12. props: {
  13. img: {
  14. type: String,
  15. default: ''
  16. },
  17. height: {
  18. type: Number,
  19. default: 521
  20. }
  21. },
  22. data() {
  23. return {
  24. // bannerImg: require('~/assets/images/products/product_banner.png')
  25. }
  26. }
  27. }
  28. </script>
  29. <style lang="scss">
  30. .common-banner {
  31. // height: 521px;
  32. position: relative;
  33. margin: 0 auto;
  34. overflow: hidden;
  35. text-align: center;
  36. max-width: 2560px;
  37. // max-width: 1920px;
  38. .bg-img {
  39. position: absolute;
  40. top: 0px;
  41. left: 50%;
  42. bottom: 0px;
  43. right: 0px;
  44. z-index: 1;
  45. -webkit-transform: translateX(-50%);
  46. transform: translateX(-50%);
  47. max-width: 2560px;
  48. // max-height: 521px;
  49. // height: 521px;
  50. display: block;
  51. }
  52. .bg-content {
  53. position: absolute;
  54. top: 0;
  55. z-index: 10;
  56. height: 100%;
  57. width: 100%;
  58. background: rgba(13, 92, 250, 0.8);
  59. }
  60. h2 {
  61. position: absolute;
  62. top: 50%;
  63. left: 50%;
  64. transform: translate(-50%, -50%);
  65. font-size: 66px;
  66. font-family: PingFangSC-Medium, PingFang SC;
  67. font-weight: 500;
  68. color: #FFFFFF;
  69. z-index: 10;
  70. }
  71. h4 {
  72. position: absolute;
  73. top: 50%;
  74. left: 50%;
  75. transform: translate(-50%, -50%);
  76. font-size: 18px;
  77. font-family: PingFangSC-Regular, PingFang SC;
  78. font-weight: 400;
  79. color: #FFFFFF;
  80. line-height: 25px;
  81. z-index: 10;
  82. margin-top: 82px;
  83. }
  84. }
  85. .content-wrap {
  86. margin-top: 85px;
  87. width: 100%;
  88. position: absolute;
  89. z-index: 10;
  90. .content {
  91. display: flex;
  92. justify-content: space-between;
  93. align-items: center;
  94. }
  95. .title {
  96. width: 396px;
  97. height: 92px;
  98. font-size: 66px;
  99. font-family: PingFangSC-Medium, PingFang SC;
  100. font-weight: 500;
  101. color: #FFFFFF;
  102. line-height: 92px;
  103. }
  104. }
  105. </style>