java-mall-app/components/uni-nav-bar/uni-status-bar.vue
2024-11-01 16:35:40 +08:00

34 lines
562 B
Vue

<template>
<view :style="{ height: statusBarHeight }" class="uni-status-bar">
<slot />
</view>
</template>
<script>
export default {
name: 'UniStatusBar',
data() {
return {
statusBarHeight: 20
}
},
mounted() {
let h = uni.getSystemInfoSync().statusBarHeight;
if (h >= 7) {
this.statusBarHeight = (h-2) + 'px'
} else {
this.statusBarHeight = h + 'px'
}
}
}
</script>
<style lang="scss" >
.uni-status-bar {
// width: 750rpx;
height: 20px;
// height: var(--status-bar-height);
}
</style>