topbar.vue 695 B

1234567891011121314151617181920212223242526272829303132
  1. <template>
  2. <view class="tabbar">
  3. <view :style="{ 'margin-top': tophight.top + 'px', 'margin-bottom': '15rpx' }">
  4. <view class="slot-box" :style="{'padding-left': `calc(100vw - ${tophight.right}px)`,'padding-right': `calc(100vw - ${tophight.left}px)`,height: tophight.height + 'px'}">
  5. <slot></slot>
  6. </view>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. data: () => ({
  13. tophight: uni.getMenuButtonBoundingClientRect(),
  14. }),
  15. mounted() {
  16. console.log(uni.getMenuButtonBoundingClientRect())
  17. }
  18. };
  19. </script>
  20. <style lang="scss" scoped>
  21. .tabbar {
  22. display: flex;
  23. background-color: #FFFFFF;
  24. .slot-box{
  25. display: flex;
  26. align-items: center;
  27. }
  28. }
  29. </style>