ea
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
Component({
|
||||
options: {
|
||||
multipleSlots: true,
|
||||
},
|
||||
properties: {
|
||||
contentHeight: {
|
||||
type: Number,
|
||||
value: 44,
|
||||
},
|
||||
paddingX: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
},
|
||||
background: {
|
||||
type: String,
|
||||
value: 'transparent',
|
||||
},
|
||||
},
|
||||
data: {
|
||||
statusBarHeight: 0,
|
||||
navHeight: 44,
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
this.updateNavMetrics()
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
updateNavMetrics() {
|
||||
const systemInfo = wx.getSystemInfoSync()
|
||||
const statusBarHeight = systemInfo.statusBarHeight || 0
|
||||
const contentHeight = Number(this.data.contentHeight) || 44
|
||||
const navHeight = statusBarHeight + contentHeight
|
||||
|
||||
this.setData({
|
||||
statusBarHeight,
|
||||
navHeight,
|
||||
})
|
||||
|
||||
this.triggerEvent('ready', {
|
||||
statusBarHeight,
|
||||
contentHeight,
|
||||
navHeight,
|
||||
})
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<view
|
||||
class="custom-nav"
|
||||
style="height: {{navHeight}}px; padding-top: {{statusBarHeight}}px; padding-left: {{paddingX}}rpx; padding-right: {{paddingX}}rpx; background: {{background}};"
|
||||
>
|
||||
<view class="custom-nav__content" style="height: {{contentHeight}}px;">
|
||||
<slot></slot>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,15 @@
|
||||
.custom-nav {
|
||||
width: 100%;
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.custom-nav__content {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
Reference in New Issue
Block a user