Skip to content

Commit

Permalink
chore: build
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenyuWang committed Jan 16, 2025
1 parent cead72c commit e77f74a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 30 deletions.
9 changes: 2 additions & 7 deletions packages/uni-h5/dist-x/uni-h5.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2784,14 +2784,9 @@ class UniPageImpl {
this.vm = vm;
this.$vm = vm;
}
get innerWidth() {
get pageBody() {
{
throw new Error("Not support innerWidth in non-browser environment");
}
}
get innerHeight() {
{
throw new Error("Not support innerHeight in non-browser environment");
throw new Error("Not support pageBody in non-browser environment");
}
}
get safeAreaInsets() {
Expand Down
40 changes: 17 additions & 23 deletions packages/uni-h5/dist-x/uni-h5.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -8179,6 +8179,19 @@ const getSystemSafeAreaInsets = function() {
let escBackPageNum = 0;
const homeDialogPages = [];
const homeSystemDialogPages = [];
function getPageWrapperInfo() {
const pageWrapper = document.querySelector("uni-page-wrapper");
const pageWrapperRect = pageWrapper.getBoundingClientRect();
const bodyRect = document.body.getBoundingClientRect();
return {
top: pageWrapperRect.top,
left: pageWrapperRect.left,
right: bodyRect.right - pageWrapperRect.right,
bottom: bodyRect.bottom - pageWrapperRect.bottom,
width: pageWrapperRect.width,
height: pageWrapperRect.height
};
}
class UniPageImpl {
constructor({
route,
Expand All @@ -8191,39 +8204,20 @@ class UniPageImpl {
this.vm = vm;
this.$vm = vm;
}
get innerWidth() {
get pageBody() {
const currentPage = getCurrentPage();
if (currentPage !== this) {
throw new Error("Can't get innerWidth of other page");
throw new Error("Can't get pageBody of other page");
}
const pageWrapper = document.querySelector("uni-page-wrapper");
return pageWrapper.clientWidth;
}
get innerHeight() {
const currentPage = getCurrentPage();
if (currentPage !== this) {
throw new Error("Can't get innerHeight of other page");
}
const pageWrapper = document.querySelector("uni-page-wrapper");
return pageWrapper.clientHeight;
return getPageWrapperInfo();
}
get safeAreaInsets() {
const currentPage = getCurrentPage();
if (currentPage !== this) {
throw new Error("Can't get safeAreaInsets of other page");
}
const pageWrapper = document.querySelector(
"uni-page-wrapper"
);
const pageWrapperRect = pageWrapper.getBoundingClientRect();
const pageWrapperEdge = getPageWrapperInfo();
const systemSafeAreaInsets = getSystemSafeAreaInsets();
const bodyRect = document.body.getBoundingClientRect();
const pageWrapperEdge = {
top: pageWrapperRect.top,
left: pageWrapperRect.left,
right: bodyRect.right - pageWrapperRect.right,
bottom: bodyRect.bottom - pageWrapperRect.bottom
};
const computeEdge = (bodyEdge, nativeEdge) => {
return Math.max(0, nativeEdge - bodyEdge);
};
Expand Down

0 comments on commit e77f74a

Please sign in to comment.