40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
"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;
|