main-layout.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <view class="layout-container">
  3. <!-- 顶部填充区 -->
  4. <view :style="{height: safeAreaStore.statusBarHeight+'px'}"></view>
  5. <!-- 顶部胶囊区 -->
  6. <view class="capsule-box"
  7. :style="{
  8. height: safeAreaStore.capsuleBarHeight+'px',
  9. width: safeAreaStore.capsuleBarLeft+'px',
  10. 'padding-top': safeAreaStore.capsuleBarMarginTop+'px',
  11. 'padding-bottom': safeAreaStore.capsuleBarMarginBottom+'px'}">
  12. <uni-icons type="back" color="#406CE7"></uni-icons>
  13. <uni-icons type="home" color="#406CE7"></uni-icons>
  14. <!-- <slot name="capsule"></slot> -->
  15. </view>
  16. <!-- 内容区 -->
  17. <view class="content-box">
  18. <slot></slot>
  19. </view>
  20. <!-- 底部填充区 -->
  21. <view :style="{height: safeAreaStore.bottomHeight+'px'}"></view>
  22. </view>
  23. </template>
  24. <script setup>
  25. import { useSafeAreaStore } from '@/stores/safeArea.js';
  26. const safeAreaStore = useSafeAreaStore();
  27. </script>
  28. <style lang="scss" scoped>
  29. .layout-container {
  30. display: flex;
  31. flex-direction: column;
  32. min-height: 100vh;
  33. background: linear-gradient(180deg, #B9D3FF 0%, #F2F7FF 22.23%);
  34. .capsule-box {
  35. padding-left: 24rpx;
  36. padding-right: 24rpx;
  37. }
  38. .content-box {
  39. /* 内容区域占满剩余空间 */
  40. flex-grow: 1;
  41. padding: 0 24rpx 16rpx 24rpx;
  42. }
  43. }
  44. </style>