// components/customStatusBar/index.js Component({ /** * 组件的属性列表 */ properties: { }, /** * 组件的初始数据 */ data: { height: 0, }, lifetimes: { attached() { const { statusBarHeight } = wx.getSystemInfoSync(); this.setData({ height: statusBarHeight }) } }, /** * 组件的方法列表 */ methods: { } })