uni-ticket-system/dist/dev/mp-weixin/tmui/tool/useFun/useWindowInfo.js
2023-12-05 10:11:10 +08:00

35 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
const common_vendor = require("../../../common/vendor.js");
const useWindowInfo = () => {
let winSize = common_vendor.reactive({
top: 0,
topSafe: 0,
width: common_vendor.index.upx2px(750),
height: common_vendor.index.upx2px(750),
statusBar: 24,
navigatorBar: 44,
bottomSafe: 0,
nvue: false,
// 是否存在系统自带的状态栏针对h5优化。
h5IsSystemBar: true
});
function init() {
var _a, _b, _c, _d, _e, _f, _g, _h;
let sysinfo = common_vendor.index.getSystemInfoSync();
winSize.topSafe = ((_a = sysinfo == null ? void 0 : sysinfo.statusBarHeight) != null ? _a : 24) + ((_b = sysinfo == null ? void 0 : sysinfo.navigationBarHeight) != null ? _b : 44);
winSize.width = (_c = sysinfo == null ? void 0 : sysinfo.windowWidth) != null ? _c : common_vendor.index.upx2px(750);
winSize.height = (_d = sysinfo == null ? void 0 : sysinfo.windowHeight) != null ? _d : common_vendor.index.upx2px(750);
winSize.statusBar = (_e = sysinfo == null ? void 0 : sysinfo.statusBarHeight) != null ? _e : 24;
winSize.navigatorBar = (_f = sysinfo == null ? void 0 : sysinfo.navigationBarHeight) != null ? _f : 44;
winSize.bottomSafe = (_h = (_g = sysinfo.safeAreaInsets) == null ? void 0 : _g.bottom) != null ? _h : 0;
}
init();
common_vendor.onMounted(() => {
setTimeout(() => {
init();
}, 0);
});
return winSize;
};
exports.useWindowInfo = useWindowInfo;