g-statusbar.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view
  3. class="status_bar"
  4. :style="{
  5. height: appOption.statusBarHeight + 'px',
  6. backgroundColor: backgroundColor,
  7. width: '100%',
  8. }"
  9. ></view>
  10. <view
  11. class="page_header"
  12. :style="{
  13. height: height + 'px',
  14. backgroundColor: backgroundColor,
  15. }"
  16. >
  17. <view
  18. class="status_bar"
  19. :style="{
  20. height: height + 'px',
  21. }"
  22. >
  23. <g-icon-fonts name="arrowleft" size="20" class="icon" @click="back" color="var(--theme-primary-color)" />
  24. <view class="status_left">
  25. <slot name="left"></slot>
  26. </view>
  27. <view class="status_title">
  28. {{ props.title }}
  29. </view>
  30. <view class="status_right">
  31. <slot name="right"></slot>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script setup lang="ts">
  37. import store from "@/store";
  38. import { ref } from "vue";
  39. const appOption = store.appOption;
  40. const height = ref(appOption.statusBarHeight || 44);
  41. const props = defineProps({
  42. title: {
  43. type: String,
  44. default: "",
  45. },
  46. backgroundColor: {
  47. type: String,
  48. default: "var(--theme-bg-color)",
  49. },
  50. });
  51. function back() {
  52. uni.navigateBack();
  53. }
  54. </script>
  55. <style scoped lang="scss">
  56. .status_bar {
  57. width: 100%;
  58. display: flex;
  59. justify-content: space-between;
  60. align-items: center;
  61. padding: 0 16rpx;
  62. color: var(--theme-primary-color);
  63. .status_title {
  64. font-weight: 600;
  65. font-size: 16px;
  66. flex: 1;
  67. text-align: center;
  68. }
  69. .status_left {
  70. text-align: left;
  71. }
  72. .icon {
  73. width: 50rpx;
  74. text-align: left;
  75. }
  76. .status_left {
  77. min-width: 50rpx;
  78. }
  79. .status_right {
  80. width: 50px;
  81. text-align: right;
  82. }
  83. }
  84. </style>