topBar.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <view class="navbar">
  3. <view class="content" :class="[`style-${styleType}`]" :style="{ background: isScrolling && [2, 3, 4, 5].includes(styleType) ? '#fff' : 'transparent' }">
  4. <view :style="{ height: `${getHeight.barTop}px` }"></view>
  5. <view class="acea-row row-center-wrapper" :style="{ height: `${getHeight.barHeight }px` }">
  6. <view class="title">个人中心</view>
  7. </view>
  8. </view>
  9. <view class="placeholder">
  10. <view :style="{ height: `${getHeight.barTop}px` }"></view>
  11. <view :style="{ height: `${getHeight.barHeight}px` }"></view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. props: {
  18. styleType: {
  19. type: Number,
  20. default: 0
  21. },
  22. isScrolling: {
  23. type: Boolean,
  24. default: false
  25. }
  26. },
  27. data() {
  28. return {
  29. getHeight: this.$util.getWXStatusHeight()
  30. };
  31. }
  32. };
  33. </script>
  34. <style lang="scss">
  35. .navbar {
  36. position: relative;
  37. .content.style-1 {
  38. background-color: var(--view-theme) !important;
  39. }
  40. .content.style-2 {
  41. background-color: #f5f5f5;
  42. .title {
  43. color: #333;
  44. }
  45. }
  46. .content.style-3 {
  47. background-color: rgba(0, 0, 0, 0);
  48. .title {
  49. color: #333;
  50. }
  51. }
  52. .content.style-4 {
  53. background-color: #f5f5f5;
  54. .title {
  55. color: #333;
  56. }
  57. }
  58. .content.style-5 {
  59. // background-color: rgba(0, 0, 0, 0);
  60. // background: #ffffff linear-gradient(180deg, #ffffff 0%, #f5f5f5 100%);
  61. // background-image: url('https://test-pro30.crmeb.net/statics/images/users/header_bg4.jpg');
  62. .title {
  63. color: #333;
  64. }
  65. }
  66. .content {
  67. position: fixed;
  68. top: 0;
  69. right: 0;
  70. left: 0;
  71. z-index: 998;
  72. background-color: var(--view-theme);
  73. font-weight: 500;
  74. font-size: 34rpx;
  75. color: #ffffff;
  76. }
  77. }
  78. </style>