bgNavBar.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view>
  3. <u-sticky offsetTop="0" customNavHeight="0" zIndex="999">
  4. <view class="content-header-sticky x-c">
  5. <image class="bg-img" src="/static/image/home/home_top_bg.png" style="z-index: -1;"></image>
  6. <uni-icons type="left" size="26" color="#fff" class="backicon" @click="$navBack()"></uni-icons>
  7. <text class="textOne" style="width: 50%;text-align: center;color: #fff;">{{title}}</text>
  8. </view>
  9. </u-sticky>
  10. <image class="bg-img" src="/static/image/home/home_top_bg.png"></image>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. props: {
  16. title: {
  17. type: String,
  18. default: ''
  19. }
  20. }
  21. }
  22. </script>
  23. <style scoped lang="scss">
  24. @mixin u-flex($flexD, $alignI, $justifyC) {
  25. display: flex;
  26. flex-direction: $flexD;
  27. align-items: $alignI;
  28. justify-content: $justifyC;
  29. }
  30. .content-header-sticky {
  31. height: calc(44px + var(--status-bar-height));
  32. padding-top: var(--status-bar-height);
  33. position: relative;
  34. z-index: 999;
  35. overflow: hidden;
  36. .backicon {
  37. position: absolute;
  38. top: calc(50% - var(--status-bar-height));
  39. left: 24rpx;
  40. transform: translateY(-50%);
  41. }
  42. }
  43. .bg-img {
  44. position: absolute;
  45. width: 100%;
  46. height: 524rpx;
  47. top: 0;
  48. left: 0;
  49. right: 0;
  50. bottom: 0;
  51. }
  52. </style>