You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.1 KiB
54 lines
1.1 KiB
1 year ago
|
<template>
|
||
1 year ago
|
<view class="mz-header-container" :style="{top:(offsetTop === '0')?offSetDefault:offsetTop,position:type}">
|
||
|
<view class="safe-area-top" :style="{height:safeHeight,display:((type !== 'sticky') || 'none')}"></view>
|
||
1 year ago
|
<slot />
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import props from './props.js';
|
||
|
/**
|
||
1 year ago
|
* header 头部
|
||
1 year ago
|
* @description 警告提示,展现需要关注的信息。
|
||
|
*
|
||
|
* @property {String} title 显示的文字
|
||
|
*/
|
||
|
export default {
|
||
1 year ago
|
name: 'mz-header',
|
||
1 year ago
|
mixins: [props],
|
||
|
data() {
|
||
|
return {
|
||
|
show: true,
|
||
|
safeHeight:''
|
||
|
}
|
||
|
},
|
||
|
computed: {
|
||
|
offSetDefault(){
|
||
|
return uni.getSystemInfoSync().statusBarHeight+44+'px';
|
||
|
},
|
||
|
},
|
||
|
methods: {
|
||
|
getSafeHeight(){
|
||
|
new Promise((resolve,reject) => {
|
||
1 year ago
|
resolve(uni.getSystemInfoSync().statusBarHeight);
|
||
1 year ago
|
}).then((height) => {
|
||
|
this.safeHeight = height+'px';
|
||
|
})
|
||
|
},
|
||
|
},
|
||
|
mounted() {
|
||
|
this.getSafeHeight();
|
||
|
},
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss" scoped>
|
||
|
.safe-area{
|
||
|
width:100%;
|
||
|
}
|
||
1 year ago
|
.mz-header-container{
|
||
1 year ago
|
width:100%;
|
||
|
z-index: 997;
|
||
|
}
|
||
|
</style>
|