p-i-s-navbar.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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" @click="go_search()">
  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. go_search(){
  42. uni.navigateTo({
  43. url:"../../pages/p-i-safety-monitoring/p-i-s-search/p-i-s-search",
  44. animationType: 'fade-in',
  45. animationDuration: 200
  46. })
  47. }
  48. }
  49. }
  50. </script>
  51. <style lang="scss" scoped>
  52. .content {
  53. position: fixed;
  54. top: 0;
  55. left: 0;
  56. z-index: 999;
  57. background-color: #009FE8;
  58. }
  59. .navbar {
  60. width: 750rpx;
  61. box-sizing: border-box;
  62. padding-left: 31rpx;
  63. padding-right: 26rpx;
  64. padding-top: 14rpx;
  65. padding-bottom: 14rpx;
  66. display: flex;
  67. justify-content: space-between;
  68. .left {
  69. width: 42rpx;
  70. line-height: 65rpx;
  71. }
  72. .right {
  73. width: 620rpx;
  74. height: 65rpx;
  75. background: rgba(255, 255, 255, 0.2);
  76. border-radius: 33rpx;
  77. .input_box {
  78. display: flex;
  79. .input_icon {
  80. margin-left: 43rpx;
  81. margin-top: 16rpx;
  82. width: 34rpx;
  83. height: 34rpx;
  84. background-image: url(icon/search.png);
  85. background-size: cover;
  86. background-repeat: no-repeat;
  87. }
  88. .input_text {
  89. margin-left: 19rpx;
  90. font-size: 24rpx;
  91. font-family: PingFangSC-Regular, PingFang SC;
  92. font-weight: 400;
  93. color: #FFFFFF;
  94. line-height: 65rpx;
  95. }
  96. }
  97. }
  98. }
  99. </style>