navbar.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view>
  3. <view class="navbar">
  4. <view class="status_bar"></view>
  5. <view class="box">
  6. <view class="left" @click="navbar_back()">
  7. <uni-icons type="arrowleft" color="#fff" size="26"></uni-icons>
  8. </view>
  9. <view class="title">
  10. <slot name="title"></slot>
  11. </view>
  12. <view class="right" @click="navbar_right()">
  13. <slot name="icon"></slot>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="status_bar"></view>
  18. <view style="height: 88rpx;"></view>
  19. <!-- 使用 -->
  20. <!-- <navbar @click_right="query()">
  21. <template #title>
  22. 水文监测
  23. </template>
  24. <template #icon>
  25. <image src="./icon/icon.png" mode=""></image>
  26. </template>
  27. </navbar> -->
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. name: "navbar",
  33. props: [
  34. "icon"
  35. ],
  36. data() {
  37. return {
  38. };
  39. },
  40. methods:{
  41. navbar_back() {
  42. uni.navigateBack()
  43. },
  44. navbar_right(){
  45. this.$emit("click_right")
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss">
  51. // 标题栏
  52. .navbar {
  53. z-index: 999;
  54. width: 750rpx;
  55. position: fixed;
  56. top: 0;
  57. left: 0;
  58. background-color: #009FE8;
  59. color: #FFFFFF;
  60. .box {
  61. background-color: #009FE8;
  62. display: flex;
  63. justify-content: space-between;
  64. align-items: center;
  65. height: 88rpx;
  66. .left {
  67. width: 80rpx;
  68. height: 88rpx;
  69. line-height: 88rpx;
  70. text-align: center;
  71. }
  72. .title {
  73. width: 500rpx;
  74. text-align: center;
  75. font-size: 36rpx;
  76. height: 88rpx;
  77. line-height: 88rpx;
  78. font-weight: 500;
  79. white-space: nowrap;
  80. text-overflow: ellipsis;
  81. overflow: hidden;
  82. }
  83. .right {
  84. width: 80rpx;
  85. height: 88rpx;
  86. text-align: left;
  87. display: flex;
  88. align-items: center;
  89. }
  90. }
  91. }
  92. </style>