12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <template>
- <view class="default_head_content">
-
- <view
- v-if="needSetStatusBarHeight" class="status_bar_fit" :style="{
- 'height': `${statusBarHeight}px`,
- 'background-color': `${backgroundColor}`
- }"
- ></view>
- </view>
- </template>
- <script>
- export default {
- name: 'DefaultHead',
- props: {
- needSetStatusBarHeight: {
- type: Boolean,
- default: () => true
- },
- backgroundColor: {
- type: String,
- default: () => '#fff'
- }
- },
- emits: [ 'getInfoData' ],
- data() {
- return {
-
- systemInfo: {},
-
- menuButtonInfo: {
- width: 0,
- height: 0,
- top: 0,
- left: 0,
- bottom: 0,
- right: 0
- },
-
- statusBarHeight: 0
- }
- },
- mounted() {
- this.handleGetSystemInfo()
-
- this.handleGetMenuButtonInfo()
-
- this.$emit('getInfoData', {
- systemInfo: this.systemInfo,
- menuButtonInfo: this.menuButtonInfo
- })
- },
- methods: {
- handleGetSystemInfo() {
- this.systemInfo = uni.getSystemInfoSync()
- this.statusBarHeight = this.systemInfo.statusBarHeight
- },
- handleGetMenuButtonInfo() {
- this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
- }
- }
- }
- </script>
- <style
- lang="scss"
- scoped
- >
- .default_head_content {
- width: 100%;
- background: #fff;
- .status_bar_fit {
- width: 100%;
- }
- }
- </style>
|