uni-status-bar.vue 640 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <view class="uni-status-bar" :style="style">
  3. <slot></slot>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. computed: {
  9. style() {
  10. //#ifdef MP-WEIXIN
  11. var systemInfo = uni.getSystemInfoSync()
  12. return `height:${systemInfo.statusBarHeight}px`
  13. //#endif
  14. //#ifdef APP-PLUS
  15. return ''
  16. //#endif
  17. }
  18. }
  19. }
  20. </script>
  21. <style>
  22. .uni-status-bar {
  23. display: block;
  24. width: 100%;
  25. height: 20px;
  26. height: var(--status-bar-height);
  27. }
  28. </style>