Component({
  properties: {
    background: {
      type: String,
      value: ''
    }
  },
  lifetimes: {
    attached() {
      const deviceInfo = wx.getDeviceInfo ? wx.getDeviceInfo() : wx.getSystemInfoSync()
      const windowInfo = wx.getWindowInfo ? wx.getWindowInfo() : wx.getSystemInfoSync()
      const platform = deviceInfo.platform
      const isAndroid = platform === 'android'
      const isDevtools = platform === 'devtools'
      const { safeArea: { top = 0 } = {} } = windowInfo

      this.setData({
        ios: !isAndroid,
        safeAreaTop: isDevtools || isAndroid ? `height: calc(var(--height) + ${top}px); padding-top: ${top}px` : ``
      })
    }
  }
})
