banner.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. <slot></slot>
  5. </div>
  6. </template>
  7. <script>
  8. export default {
  9. props: {
  10. img: {
  11. type: String,
  12. default: ''
  13. },
  14. height: {
  15. type: Number,
  16. default: 521
  17. }
  18. },
  19. data() {
  20. return {
  21. // bannerImg: require('~/assets/images/products/product_banner.png')
  22. }
  23. }
  24. }
  25. </script>
  26. <style lang="scss">
  27. .common-banner {
  28. width: 100%;
  29. // height: 521px;
  30. position: relative;
  31. margin: 0 auto;
  32. overflow: hidden;
  33. text-align: center;
  34. .bg-img {
  35. position: absolute;
  36. top: 0px;
  37. left: 50%;
  38. bottom: 0px;
  39. right: 0px;
  40. z-index: 1;
  41. -webkit-transform: translateX(-50%);
  42. transform: translateX(-50%);
  43. max-width: 2560px;
  44. // max-height: 521px;
  45. // height: 521px;
  46. display: block;
  47. }
  48. h2 {
  49. position: absolute;
  50. top: 50%;
  51. left: 50%;
  52. transform: translate(-50%, -50%);
  53. font-size: 66px;
  54. font-family: PingFangSC-Medium, PingFang SC;
  55. font-weight: 500;
  56. color: #FFFFFF;
  57. z-index: 10;
  58. }
  59. }
  60. .content-wrap {
  61. margin-top: 94px;
  62. width: 100%;
  63. position: absolute;
  64. z-index: 10;
  65. .content {
  66. display: flex;
  67. justify-content: space-between;
  68. align-items: center;
  69. }
  70. .title {
  71. width: 396px;
  72. height: 92px;
  73. font-size: 66px;
  74. font-family: PingFangSC-Medium, PingFang SC;
  75. font-weight: 500;
  76. color: #FFFFFF;
  77. line-height: 92px;
  78. }
  79. }
  80. </style>