1.獲取裝置資訊,螢幕的高度,狀態列高度等
onLoad: function () {
// 獲取螢幕的高度
let sysInfo = wx.getSystemInfoSync();
let winHeight = sysInfo.windowHeight;
let winWidth = sysInfo.windowWidth;
this.winHeight = winHeight;
this.winWidth = winWidth;
console.log(winHeight,winWidth);
},
wx.getSystemInfo({
success: e => {
globalData.commit('setStatusBar', e.statusBarHeight);
globalData.commit('setCustomBar', e.platform === 'android' ? e.statusBarHeight + 50 : e.statusBarHeight + 45);
}
});
複製程式碼