header.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="navbar">
  3. <view class="content" :style="{ background: isScrolling ? '#fff' : bagColor }">
  4. <view :style="{ height: `${getHeight.barTop}px` }"></view>
  5. <view class="acea-row bar" :style="{ height: `${getHeight.barHeight}px`,width: `${750-2*getHeight.barWidth}rpx` }">
  6. <view class="back-icon acea-row row-center-wrapper">
  7. <view
  8. v-show="showBack"
  9. @click="back"
  10. class="iconfont icon-xiangzuo back-icon"
  11. :style="{ lineHeight: `${getHeight.barHeight}rpx`}"
  12. ></view>
  13. </view>
  14. <view class="title">{{ titleText }}</view>
  15. <view class="h-80 px-5 flex-y-center">
  16. <view class="w-full h-58 flex-y-center rd-30rpx bg--w111-fff px-32">
  17. <text class="iconfont icon-sousuo8 fs-28"></text>
  18. <input class="fs-24 pl-18" placeholder="搜索商品名称或订单号">
  19. </view>
  20. <view class="search_right_icon">
  21. </view>
  22. </view>
  23. <!-- <view class="right-icon acea-row row-center-wrapper">
  24. <view v-show="showRight" class="right-icon"></view>
  25. </view> -->
  26. </view>
  27. </view>
  28. <view class="placeholder">
  29. <view :style="{ height: `${getHeight.barTop}px` }"></view>
  30. <view :style="{ height: `${getHeight.barHeight}px` }"></view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. name: 'headerNav',
  37. props: {
  38. // 滚动至下部
  39. isScrolling: {
  40. type: Boolean,
  41. default: false
  42. },
  43. // 是否显示返回icon
  44. showBack: {
  45. type: Boolean,
  46. default: false
  47. },
  48. // Title
  49. titleText: {
  50. type: String,
  51. default: ''
  52. },
  53. // 背景色
  54. bagColor: {
  55. type: String,
  56. default: 'transparent'
  57. }
  58. },
  59. data() {
  60. return {
  61. getHeight: this.$util.getWXStatusHeight()
  62. };
  63. },
  64. methods: {
  65. back() {
  66. uni.navigateBack();
  67. }
  68. }
  69. };
  70. </script>
  71. <style lang="scss">
  72. .navbar {
  73. position: relative;
  74. color: #333;
  75. .content {
  76. position: fixed;
  77. top: 0;
  78. right: 0;
  79. left: 0;
  80. z-index: 998;
  81. background-color: var(--view-theme);
  82. font-weight: 500;
  83. font-size: 34rpx;
  84. color: #ffffff;
  85. .back-icon,
  86. .right-icon {
  87. width: 40rpx;
  88. height: 40rpx;
  89. }
  90. .bar {
  91. align-items: center;
  92. }
  93. .title {
  94. margin-left: 10rpx;
  95. }
  96. }
  97. }
  98. .search_right_icon{
  99. width: 80rpx;
  100. height: 60rpx;
  101. border-radius: 30rpx;
  102. background: darkgray;
  103. margin-left: 20rpx;
  104. }
  105. .icon-sousuo8{
  106. color: #333;
  107. }
  108. .h-80{
  109. width: 75%;
  110. margin-left: 10rpx;
  111. }
  112. .icon-xiangzuo,.title{
  113. color: #999999;
  114. font-size: 30rpx;
  115. }
  116. </style>