nav-bar.vue 962 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <template>
  2. <view class="nav-bar">
  3. <view class="nav-bar-status" :style="{ height: statusBarHeight + 'px' }">
  4. </view>
  5. <view class="nav-bar-title" :style="{ height: titleBarHeight +'px' }">
  6. <view></view>
  7. <view>慕尼黑展览公司</view>
  8. <view></view>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. props: {},
  15. data() {
  16. return {
  17. titleBarHeight: 0,
  18. statusBarHeight: 0,
  19. isNotchScreen: false
  20. }
  21. },
  22. created() {
  23. const systemInfo = uni.getSystemInfoSync()
  24. this.statusBarHeight = systemInfo.statusBarHeight
  25. const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  26. this.titleBarHeight = (menuButtonInfo.top - this.statusBarHeight) * 2 + menuButtonInfo.height
  27. console.log(systemInfo)
  28. }
  29. }
  30. </script>
  31. <style lang="scss" scoped>
  32. .nav-bar {
  33. background-color: $primary-color;
  34. }
  35. .nav-bar-title{
  36. display: flex;
  37. justify-content: space-between;
  38. align-items: center;
  39. color: #ffffff;
  40. }
  41. </style>