p-i-o-navbar.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view>
  3. <view class="content">
  4. <view :style="{height:statusBarHeight + 'px'}">
  5. <!-- 这里是状态栏 -->
  6. </view>
  7. <view class="navbar">
  8. <view class="left" @click="click_left()">
  9. <uni-icons type="arrowleft" color="#fff" size="18"></uni-icons>
  10. </view>
  11. <view class="right">
  12. <view class="input_box">
  13. <view class="input_icon"></view>
  14. <view class="input_text">搜索井下人员</view>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <!-- 占位符 -->
  20. <view :style="{height: statusBarHeight + 'px'}"></view>
  21. <view style="height: 93rpx;"></view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. statusBarHeight: 20,
  29. };
  30. },
  31. created() {
  32. // 获取手机系统信息
  33. const info = uni.getSystemInfoSync()
  34. // 设置状态栏高度
  35. this.statusBarHeight = info.statusBarHeight
  36. },
  37. methods: {
  38. click_left() {
  39. uni.navigateBack();
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss">
  45. .content {
  46. position: fixed;
  47. top: 0;
  48. left: 0;
  49. background-color: #009FE8;
  50. z-index: 999;
  51. }
  52. .navbar {
  53. width: 750rpx;
  54. box-sizing: border-box;
  55. padding-left: 31rpx;
  56. padding-right: 26rpx;
  57. padding-top: 14rpx;
  58. padding-bottom: 14rpx;
  59. display: flex;
  60. justify-content: space-between;
  61. .left {
  62. width: 42rpx;
  63. line-height: 65rpx;
  64. }
  65. .right {
  66. width: 620rpx;
  67. height: 65rpx;
  68. background: rgba(255, 255, 255, 0.2);
  69. border-radius: 33rpx;
  70. .input_box {
  71. display: flex;
  72. .input_icon {
  73. margin-left: 43rpx;
  74. margin-top: 16rpx;
  75. width: 34rpx;
  76. height: 34rpx;
  77. background-image: url(icon/search.png);
  78. background-size: cover;
  79. background-repeat: no-repeat;
  80. }
  81. .input_text {
  82. margin-left: 19rpx;
  83. font-size: 24rpx;
  84. font-family: PingFangSC-Regular, PingFang SC;
  85. font-weight: 400;
  86. color: #FFFFFF;
  87. line-height: 65rpx;
  88. }
  89. }
  90. }
  91. }
  92. </style>