mixin.js 502 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
export const systemInfo = {
  data: () => ({
    statusBarHeight: 0,
    navigationBarHeight: 0,
    navHeight: 0,
    windowHeight: 0, // 可使用窗口高度
  }),

  methods: {
    // 获取设备信息
    getSystemInfo() {
      this.statusBarHeight = getApp().globalData.statusBarHeight;
      this.navigationBarHeight = getApp().globalData.navigationBarHeight;
      this.windowHeight = uni.getSystemInfoSync().windowHeight;
      this.navHeight = getApp().globalData.navHeight;
    },
  },
};