49 lines
878 B
TypeScript
49 lines
878 B
TypeScript
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,
|
||
|
|
})
|
||
|
|
},
|
||
|
|
},
|
||
|
|
})
|
||
|
|
|