mkm
/
yanzhiAPP
Template
2
0
Fork 0
yanzhiAPP/node_modules/uview-plus/components/u-status-bar/u-status-bar.vue

49 lines
1.3 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view
:style="[style]"
class="u-status-bar"
>
<slot />
</view>
</template>
<script>
import props from './props.js';
import mpMixin from '../../libs/mixin/mpMixin.js';
import mixin from '../../libs/mixin/mixin.js';
/**
* StatbusBar 状态栏占位
* @description 本组件主要用于状态填充,比如在自定导航栏的时候,它会自动适配一个恰当的状态栏高度。
* @tutorial https://uiadmin.net/uview-plus/components/statusBar.html
* @property {String} bgColor 背景色 (默认 'transparent' )
* @property {String | Object} customStyle 自定义样式
* @example <u-status-bar></u-status-bar>
*/
export default {
name: 'u-status-bar',
mixins: [mpMixin, mixin, props],
data() {
return {
}
},
computed: {
style() {
const style = {}
// 状态栏高度由于某些安卓和微信开发工具无法识别css的顶部状态栏变量所以使用js获取的方式
style.height = uni.$u.addUnit(uni.$u.sys().statusBarHeight, 'px')
style.backgroundColor = this.bgColor
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
}
},
}
</script>
<style lang="scss" scoped>
.u-status-bar {
// nvue会默认100%如果nvue下显式写100%的话会导致宽度不为100%而异常
/* #ifndef APP-NVUE */
width: 100%;
/* #endif */
}
</style>