ea
This commit is contained in:
@@ -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,
|
||||
})
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user