ax-body.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <view class="ax ax-body" :style="[StyleSheet]">
  3. <ax-custom-title v-if="$slots.title" @display="$emit('display',$event)"><slot name="title"></slot></ax-custom-title>
  4. <ax-custom-title v-else @display="$emit('display',$event)"></ax-custom-title>
  5. <view class="__root"><slot></slot></view>
  6. <ax-ios-indicator v-if="hideIndicatorArea==false"></ax-ios-indicator>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. name:"ax-body",
  12. props:{
  13. // 两侧留白范围
  14. blank:{type:[Number,String],default:10},
  15. // 隐藏指示器范围占位
  16. hideIndicatorArea:{type:Boolean,default:false}
  17. },
  18. mounted() {
  19. uni.createSelectorQuery().in(this).select(".__root").boundingClientRect((data) => {
  20. if(data) this.$emit('init',data);
  21. }).exec();
  22. },
  23. computed:{
  24. StyleSheet(){
  25. return {
  26. '--blank': `${Number(this.blank) || 0}px`
  27. }
  28. }
  29. }
  30. }
  31. </script>
  32. <style>
  33. .ax-body{
  34. display: flex;
  35. flex-direction: column;
  36. height: 100%;
  37. }
  38. .ax-body .__root{
  39. flex: 1;
  40. overflow: auto;
  41. padding-left: var(--blank) !important;
  42. padding-right: var(--blank) !important;
  43. }
  44. ax-custom-title{
  45. position: relative;
  46. z-index: 99999999;
  47. }
  48. </style>