更新最新代码
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// 只计算设备布局,不保存接口数据。
|
||||
function getLayout() {
|
||||
var info = {};
|
||||
try { info = wx.getWindowInfo ? wx.getWindowInfo() : wx.getSystemInfoSync(); } catch (e) {}
|
||||
var status = info.statusBarHeight || 20;
|
||||
var capsule;
|
||||
try { capsule = wx.getMenuButtonBoundingClientRect(); } catch (e) {}
|
||||
var bar = capsule && capsule.height > 0 && capsule.top >= status
|
||||
? capsule.height + (capsule.top - status) * 2 : 44;
|
||||
var height = status + bar;
|
||||
var width = info.windowWidth || 375;
|
||||
var side = capsule && capsule.left > width / 2 ? width - capsule.left + 12 : 100;
|
||||
return { statusBarHeight: status, barHeight: bar, navHeight: height, navSide: side,
|
||||
layoutStyle: '--nav-height:' + height + 'px;--status-height:' + status + 'px;' };
|
||||
}
|
||||
module.exports = { getLayout };
|
||||
Reference in New Issue
Block a user