z-navbar.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view>
  3. <view class="navbar" :style="{'background':bgcolor,'color':color,'zIndex':zIndex}">
  4. <view class="status_bar">
  5. </view>
  6. <view class="flex-n fac title_bar plr-30" v-if="!hideTitle">
  7. <view class="flex-1">
  8. <view class="go_back iconfont iconfanhui" @click="diyBack?$emit('goBack'):goBack()" v-if="back">
  9. </view>
  10. <slot name="left"></slot>
  11. </view>
  12. <view class="title">
  13. <template v-if="title">{{title}}</template>
  14. <slot name="title"></slot>
  15. </view>
  16. <view class="flex-1 flex-n fac fje">
  17. <slot name="right" ></slot>
  18. <view class="rightbtn" v-if="btnText" @click="$emit('click')">{{btnText}}</view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="seat" v-if="!hideTitle"></view>
  23. <view class="seat2" v-else></view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. name: 'z-navbar',
  29. props: {
  30. title: String,
  31. btnText: String,
  32. hideTitle:Boolean,
  33. zIndex:{
  34. type:Number,
  35. default:500
  36. },
  37. bgcolor: {
  38. type: String,
  39. default: '#354054'
  40. },
  41. color: {
  42. type: String,
  43. default: 'white'
  44. },
  45. back: {
  46. type: Boolean,
  47. default: false
  48. },
  49. float: {
  50. type: String,
  51. default: 'right'
  52. },
  53. diyBack:Boolean
  54. },
  55. methods: {
  56. goBack() {
  57. uni.navigateBack({
  58. delta: 1
  59. });
  60. }
  61. }
  62. }
  63. </script>
  64. <style scoped lang="scss">
  65. .navbar {
  66. position: fixed;
  67. top: 0;
  68. // z-index: 500;
  69. width: 100vw;
  70. .status_bar {
  71. height: var(--status-bar-height);
  72. }
  73. .title_bar {
  74. height: 84rpx;
  75. font-size: 36rpx;
  76. .go_back {
  77. color: white;
  78. width: 30rpx;
  79. font-size: 30rpx;
  80. height: 30rpx;
  81. }
  82. .rightbtn{
  83. font-size: 28rpx;
  84. }
  85. }
  86. }
  87. .seat {
  88. height: calc(var(--status-bar-height) + 84rpx);
  89. }
  90. .seat2{
  91. height: var(--status-bar-height);
  92. }
  93. </style>