StatusBar.vue
872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<template>
<view class="status_bar" :style="{height:height + 'px','background-color': bgColor}" ></view>
<view class="block" :style="{height: height+'px','background-color': bgColor}"></view>
</template>
<script setup>
import {
onMounted,
ref
} from 'vue';
defineProps({
bgColor:{
type:String,
default:'rgba(0,0,0,0)'
}
})
// h5默认设置为0
const height = ref(uni.getSystemInfoSync().statusBarHeight || 0)
// onMounted(() => {
// // #ifdef APP
// height.value = plus.navigator.getStatusbarHeight()
// // #endif
// // #ifdef MP-WEIXIN
// height.value = 25
// // #endif
// })
</script>
<style>
.status_bar {
width: 750rpx;
position: fixed;
top: 0;
left: 0;
z-index: 9999;
/* background-color: transparent; */
/* background-color: rgba(255,0,0,0.3); */
}
</style>