custom-statusbar.vue 535 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <view :style="{ height: statusBarHeight + 'px' }" class="status-bar">
  3. <slot />
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. name: 'CustomStatusBar',
  9. data() {
  10. return {
  11. statusBarHeight: 20
  12. }
  13. },
  14. mounted() {
  15. this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
  16. // #ifdef H5
  17. this.statusBarHeight = 20
  18. // #endif
  19. }
  20. }
  21. </script>
  22. <style lang="scss" >
  23. .status-bar {
  24. // width: 750rpx;
  25. height: 20px;
  26. // height: var(--status-bar-height);
  27. }
  28. </style>