1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <template>
- <view
- :style="[style]"
- class="u-status-bar"
- :class="[isH5 && 'u-safe-area-inset-top']"
- >
- <slot />
- </view>
- </template>
- <script>
- import { props } from './props';
- import { mpMixin } from '../../libs/mixin/mpMixin';
- import { mixin } from '../../libs/mixin/mixin';
- import { addUnit, addStyle, deepMerge, getWindowInfo } from '../../libs/function/index';
-
- export default {
- name: 'u-status-bar',
- mixins: [mpMixin, mixin, props],
- data() {
- return {
- isH5: true
- }
- },
- created() {
-
- this.isH5 = true
-
- },
- computed: {
- style() {
- const style = {}
-
- style.height = addUnit(getWindowInfo().statusBarHeight, 'px')
- style.backgroundColor = this.bgColor
- return deepMerge(style, addStyle(this.customStyle))
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .u-status-bar {
- // nvue会默认100%,如果nvue下,显式写100%的话,会导致宽度不为100%而异常
- /* #ifndef APP-NVUE */
- width: 100%;
- /* #endif */
- }
- </style>
|