jiuyiUniapp/jiuyi2/unpackage/dist/dev/mp-weixin/components/public/Mixins.js

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2024-12-18 15:46:27 +08:00
"use strict";
const common_vendor = require("../../common/vendor.js");
const statusBarHeight = (isUnit) => {
let h = common_vendor.index.getSystemInfoSync().statusBarHeight;
h = h ? h : 0;
return isUnit ? h : `${h}px`;
};
const bottomSafeAreaHeight = (isUnit) => {
let b = common_vendor.index.getSystemInfoSync().safeAreaInsets.bottom;
b = b ? b : 0;
return isUnit ? b : `${b}px`;
};
const screenWidth = (isUnit) => {
let w = common_vendor.index.getSystemInfoSync().screenWidth;
w = w ? w : 0;
return isUnit ? w : `${w}px`;
};
const screenHeight = (isUnit) => {
let h = common_vendor.index.getSystemInfoSync().screenHeight;
h = h ? h : 0;
return isUnit ? h : `${h}px`;
};
const goBack = (url) => {
const pages = getCurrentPages();
if (pages.length > 1) {
return common_vendor.index.navigateBack({
delta: 1
});
} else {
return common_vendor.index.reLaunch({
url
});
}
};
exports.bottomSafeAreaHeight = bottomSafeAreaHeight;
exports.goBack = goBack;
exports.screenHeight = screenHeight;
exports.screenWidth = screenWidth;
exports.statusBarHeight = statusBarHeight;