gracePage.nvue 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <view class="gui-sbody" :style="{flex:flexVal}">
  3. <!-- 头部导航 -->
  4. <view v-if="customHeader">
  5. <view class="gui-page-header" :style="{'z-index':headerIndex, backgroundColor:headerBG, borderBottomWidth:borderWidth, borderBottomColor:borderColor}">
  6. <!-- 沉浸式状态栏 -->
  7. <view class="gui-page-status-bar" :style="{height:statusBarHeight+'px', backgroundColor:statusBarBG}"></view>
  8. <!-- 头部核心 -->
  9. <view class="gui-page-header-nav" :style="{height:headerHeight+'px'}">
  10. <view class="gui-header-main gui-flex-auto">
  11. <slot name="gHeader"></slot>
  12. </view>
  13. <view :style="{width:BoundingWidth, height:'10px'}"></view>
  14. </view>
  15. </view>
  16. <!-- 占位 view -->
  17. <view :style="{width:'750rpx', height:(statusBarHeight + headerHeight) + 'px'}"></view>
  18. </view>
  19. <!-- 页面主体 -->
  20. <view class="gui-page-body" :style="{flex:flexVal}"><slot name="gBody"></slot></view>
  21. <!-- 页面底部 -->
  22. <view class="gui-page-footer" :style="{'z-index':footerIndex, backgroundColor:footerBg}">
  23. <slot name="gFooter"></slot>
  24. </view>
  25. <!-- 右下角悬浮按钮 -->
  26. <view class="gui-page-rb-area" :style="{right:rbRight+'rpx', bottom:rbBottom+'rpx', width:rbWidth+'rpx'}"><slot name="gRTArea"></slot></view>
  27. </view>
  28. </template>
  29. <script>
  30. export default{
  31. props:{
  32. customHeader : { type : Boolean, default : true },
  33. headerHeight : { type : Number, default : 44 },
  34. headerIndex : { type : Number, default : 999 },
  35. headerBG : { type : String, default : '#FFFFFF'},
  36. statusBarBG : { type : String, default : '#FFFFFF'},
  37. footerIndex : { type : Number, default : 999},
  38. rbWidth : { type : Number, default : 100},
  39. rbBottom : { type : Number, default : 100 },
  40. rbRight : { type : Number, default : 20 },
  41. footerBg : { type : String, default : '' },
  42. flexVal : { type : String, default : ''},
  43. borderWidth : { type : String, default : '0' },
  44. borderColor : { type : String, default : '#D1D1D1' }
  45. },
  46. data() {
  47. return {
  48. statusBarHeight : 0,
  49. iphoneXButtomHeight:0,
  50. BoundingWidth : '0px'
  51. }
  52. },
  53. created:function(){
  54. try {
  55. var res = uni.getSystemInfoSync();
  56. } catch (e){
  57. return null;
  58. }
  59. if(!this.customHeader){return ;}
  60. this.statusBarHeight = res.statusBarHeight;
  61. }
  62. }
  63. </script>
  64. <style scoped>
  65. .gui-sbody{width:750rpx;}
  66. .gui-page-header{width:750rpx; position:fixed; left:0; top:0; z-index:99; border-style:solid;}
  67. .gui-page-status-bar{width:750rpx; height:0;}
  68. .gui-page-header-nav{width:750rpx; flex-direction:row; flex-wrap:nowrap;}
  69. .gui-header-main{width:750rpx;}
  70. .gui-page-body{width:750rpx;}
  71. .gui-page-footer{width:750rpx; position:fixed; left:0; bottom:0; z-index:99;}
  72. .gui-page-rb-area{width:100rpx; position:fixed; right:20rpx; bottom:100rpx; z-index:100;}
  73. </style>