fix(footer): 功能页页脚改为独立底栏,显示在功能区外且不产生滚动条
上一版遗留两问题: 1) 页脚压住内容:/json-prettify 底部工具行 828-877、页脚 869-888 -> 实际被压住 2) 滚动条:上一版用 padding-bottom:56px 留白,而撑满视口型工具高度按 window.innerHeight-top-12 算(正好到888),888+56=944>900 -> 凭空多44px滚动条 改法(预留独立底栏,不用 padding): - base.layout.vue 功能页滚动区 height:calc(100% - 44px)、padding-bottom:0 -> 滚动区缩到856 页脚固定在其下方独立底栏(869-888),不在功能区之内 - 12个撑满视口工具(json-viewer/label-designer/ai-chat/translator/image-ocr/pdf-ocr/ doc-convert/pdf-tools/image-tools/code-reader/site-bookmarks/ai-retouch/barcode-batch-generator) 高度改为按滚动区底边计算,不再用 window.innerHeight,随底栏自动收缩 验证(20个功能页):fixed / 页脚在滚动区外(856<869) / 滚到底零遮挡(余13-421px) 全通过; 12个页面滚动条由有变无;仅4个内容本身超长页保留滚动条(/ai-chat,/emoji-picker, /text-to-image,/encryption)且底部不被遮挡;视觉核验 /json-prettify 底部工具行完整可见
This commit is contained in:
1 parent
7aeb8b74ef
commit
311ab1b139
14 files changed
+124
-27
No files matched your search
@@ -261,8 +261,14 @@ const rootStyle = ref<Record<string, string>>({});
|
||||
function fit() {
|
||||
const el = rootEl.value;
|
||||
if (!el) return;
|
||||
const top = el.getBoundingClientRect().top;
|
||||
const height = Math.max(340, window.innerHeight - top - 12);
|
||||
const top = el.getBoundingClientRect().top;
|
||||
// 高度按「内容滚动区底边」计算,而不是 window.innerHeight:
|
||||
// 功能页底部预留了固定页脚的空间,用视口高度会把内容撑到页脚下方,既遮挡又产生滚动条
|
||||
const scroller = el.closest('.n-layout-scroll-container');
|
||||
const bottom = scroller
|
||||
? scroller.getBoundingClientRect().bottom - Number.parseFloat(getComputedStyle(scroller).paddingBottom || '0')
|
||||
: window.innerHeight - 12;
|
||||
const height = Math.max(340, bottom - top);
|
||||
rootStyle.value = { height: `${height}px`, flex: '1 1 100%' };
|
||||
}
|
||||
|
||||
|
||||
@@ -165,8 +165,14 @@ function fit() {
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
const top = el.getBoundingClientRect().top;
|
||||
const height = Math.max(300, window.innerHeight - top - 12);
|
||||
const top = el.getBoundingClientRect().top;
|
||||
// 高度按「内容滚动区底边」计算,而不是 window.innerHeight:
|
||||
// 功能页底部预留了固定页脚的空间,用视口高度会把内容撑到页脚下方,既遮挡又产生滚动条
|
||||
const scroller = el.closest('.n-layout-scroll-container');
|
||||
const bottom = scroller
|
||||
? scroller.getBoundingClientRect().bottom - Number.parseFloat(getComputedStyle(scroller).paddingBottom || '0')
|
||||
: window.innerHeight - 12;
|
||||
const height = Math.max(300, bottom - top);
|
||||
rootStyle.value = { height: `${height}px`, flex: '1 1 100%' };
|
||||
}
|
||||
|
||||
|
||||
@@ -183,8 +183,14 @@ function fit() {
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
const top = el.getBoundingClientRect().top;
|
||||
const height = Math.max(300, window.innerHeight - top - 12);
|
||||
const top = el.getBoundingClientRect().top;
|
||||
// 高度按「内容滚动区底边」计算,而不是 window.innerHeight:
|
||||
// 功能页底部预留了固定页脚的空间,用视口高度会把内容撑到页脚下方,既遮挡又产生滚动条
|
||||
const scroller = el.closest('.n-layout-scroll-container');
|
||||
const bottom = scroller
|
||||
? scroller.getBoundingClientRect().bottom - Number.parseFloat(getComputedStyle(scroller).paddingBottom || '0')
|
||||
: window.innerHeight - 12;
|
||||
const height = Math.max(300, bottom - top);
|
||||
rootStyle.value = { height: `${height}px`, flex: '1 1 100%' };
|
||||
}
|
||||
|
||||
|
||||
@@ -182,8 +182,14 @@ function fit() {
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
const top = el.getBoundingClientRect().top;
|
||||
const height = Math.max(360, window.innerHeight - top - 12);
|
||||
const top = el.getBoundingClientRect().top;
|
||||
// 高度按「内容滚动区底边」计算,而不是 window.innerHeight:
|
||||
// 功能页底部预留了固定页脚的空间,用视口高度会把内容撑到页脚下方,既遮挡又产生滚动条
|
||||
const scroller = el.closest('.n-layout-scroll-container');
|
||||
const bottom = scroller
|
||||
? scroller.getBoundingClientRect().bottom - Number.parseFloat(getComputedStyle(scroller).paddingBottom || '0')
|
||||
: window.innerHeight - 12;
|
||||
const height = Math.max(360, bottom - top);
|
||||
rootStyle.value = { height: `${height}px`, flex: '1 1 100%' };
|
||||
}
|
||||
|
||||
|
||||
@@ -154,8 +154,14 @@ function fit() {
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
const top = el.getBoundingClientRect().top;
|
||||
const height = Math.max(300, window.innerHeight - top - 12);
|
||||
const top = el.getBoundingClientRect().top;
|
||||
// 高度按「内容滚动区底边」计算,而不是 window.innerHeight:
|
||||
// 功能页底部预留了固定页脚的空间,用视口高度会把内容撑到页脚下方,既遮挡又产生滚动条
|
||||
const scroller = el.closest('.n-layout-scroll-container');
|
||||
const bottom = scroller
|
||||
? scroller.getBoundingClientRect().bottom - Number.parseFloat(getComputedStyle(scroller).paddingBottom || '0')
|
||||
: window.innerHeight - 12;
|
||||
const height = Math.max(300, bottom - top);
|
||||
rootStyle.value = { height: `${height}px`, flex: '1 1 100%' };
|
||||
}
|
||||
|
||||
|
||||
@@ -845,8 +845,14 @@ function fit() {
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
const top = el.getBoundingClientRect().top;
|
||||
const height = Math.max(360, window.innerHeight - top - 12);
|
||||
const top = el.getBoundingClientRect().top;
|
||||
// 高度按「内容滚动区底边」计算,而不是 window.innerHeight:
|
||||
// 功能页底部预留了固定页脚的空间,用视口高度会把内容撑到页脚下方,既遮挡又产生滚动条
|
||||
const scroller = el.closest('.n-layout-scroll-container');
|
||||
const bottom = scroller
|
||||
? scroller.getBoundingClientRect().bottom - Number.parseFloat(getComputedStyle(scroller).paddingBottom || '0')
|
||||
: window.innerHeight - 12;
|
||||
const height = Math.max(360, bottom - top);
|
||||
rootStyle.value = { height: `${height}px`, flex: '1 1 100%' };
|
||||
}
|
||||
|
||||
|
||||
@@ -453,8 +453,14 @@ function fit() {
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
const top = el.getBoundingClientRect().top;
|
||||
const height = Math.max(360, window.innerHeight - top - 12);
|
||||
const top = el.getBoundingClientRect().top;
|
||||
// 高度按「内容滚动区底边」计算,而不是 window.innerHeight:
|
||||
// 功能页底部预留了固定页脚的空间,用视口高度会把内容撑到页脚下方,既遮挡又产生滚动条
|
||||
const scroller = el.closest('.n-layout-scroll-container');
|
||||
const bottom = scroller
|
||||
? scroller.getBoundingClientRect().bottom - Number.parseFloat(getComputedStyle(scroller).paddingBottom || '0')
|
||||
: window.innerHeight - 12;
|
||||
const height = Math.max(360, bottom - top);
|
||||
rootStyle.value = { height: `${height}px`, flex: '1 1 100%' };
|
||||
}
|
||||
|
||||
|
||||
@@ -966,8 +966,14 @@ function fit() {
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
const top = el.getBoundingClientRect().top;
|
||||
const height = Math.max(320, window.innerHeight - top - 12);
|
||||
const top = el.getBoundingClientRect().top;
|
||||
// 高度按「内容滚动区底边」计算,而不是 window.innerHeight:
|
||||
// 功能页底部预留了固定页脚的空间,用视口高度会把内容撑到页脚下方,既遮挡又产生滚动条
|
||||
const scroller = el.closest('.n-layout-scroll-container');
|
||||
const bottom = scroller
|
||||
? scroller.getBoundingClientRect().bottom - Number.parseFloat(getComputedStyle(scroller).paddingBottom || '0')
|
||||
: window.innerHeight - 12;
|
||||
const height = Math.max(320, bottom - top);
|
||||
rootStyle.value = { height: `${height}px`, flex: '1 1 100%' };
|
||||
requestAnimationFrame(measure);
|
||||
}
|
||||
|
||||
@@ -230,8 +230,14 @@ function fit() {
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
const top = el.getBoundingClientRect().top;
|
||||
const height = Math.max(300, window.innerHeight - top - 12);
|
||||
const top = el.getBoundingClientRect().top;
|
||||
// 高度按「内容滚动区底边」计算,而不是 window.innerHeight:
|
||||
// 功能页底部预留了固定页脚的空间,用视口高度会把内容撑到页脚下方,既遮挡又产生滚动条
|
||||
const scroller = el.closest('.n-layout-scroll-container');
|
||||
const bottom = scroller
|
||||
? scroller.getBoundingClientRect().bottom - Number.parseFloat(getComputedStyle(scroller).paddingBottom || '0')
|
||||
: window.innerHeight - 12;
|
||||
const height = Math.max(300, bottom - top);
|
||||
rootStyle.value = { height: `${height}px`, flex: '1 1 100%' };
|
||||
}
|
||||
|
||||
|
||||
@@ -494,8 +494,14 @@ function fit() {
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
const top = el.getBoundingClientRect().top;
|
||||
const height = Math.max(360, window.innerHeight - top - 12);
|
||||
const top = el.getBoundingClientRect().top;
|
||||
// 高度按「内容滚动区底边」计算,而不是 window.innerHeight:
|
||||
// 功能页底部预留了固定页脚的空间,用视口高度会把内容撑到页脚下方,既遮挡又产生滚动条
|
||||
const scroller = el.closest('.n-layout-scroll-container');
|
||||
const bottom = scroller
|
||||
? scroller.getBoundingClientRect().bottom - Number.parseFloat(getComputedStyle(scroller).paddingBottom || '0')
|
||||
: window.innerHeight - 12;
|
||||
const height = Math.max(360, bottom - top);
|
||||
rootStyle.value = { height: `${height}px`, flex: '1 1 100%' };
|
||||
}
|
||||
|
||||
|
||||
@@ -327,8 +327,14 @@ function fit() {
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
const top = el.getBoundingClientRect().top;
|
||||
const height = Math.max(360, window.innerHeight - top - 12);
|
||||
const top = el.getBoundingClientRect().top;
|
||||
// 高度按「内容滚动区底边」计算,而不是 window.innerHeight:
|
||||
// 功能页底部预留了固定页脚的空间,用视口高度会把内容撑到页脚下方,既遮挡又产生滚动条
|
||||
const scroller = el.closest('.n-layout-scroll-container');
|
||||
const bottom = scroller
|
||||
? scroller.getBoundingClientRect().bottom - Number.parseFloat(getComputedStyle(scroller).paddingBottom || '0')
|
||||
: window.innerHeight - 12;
|
||||
const height = Math.max(360, bottom - top);
|
||||
rootStyle.value = { height: `${height}px`, flex: '1 1 100%' };
|
||||
}
|
||||
|
||||
|
||||
@@ -281,8 +281,14 @@ function fit() {
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
const top = el.getBoundingClientRect().top;
|
||||
const height = Math.max(300, window.innerHeight - top - 12);
|
||||
const top = el.getBoundingClientRect().top;
|
||||
// 高度按「内容滚动区底边」计算,而不是 window.innerHeight:
|
||||
// 功能页底部预留了固定页脚的空间,用视口高度会把内容撑到页脚下方,既遮挡又产生滚动条
|
||||
const scroller = el.closest('.n-layout-scroll-container');
|
||||
const bottom = scroller
|
||||
? scroller.getBoundingClientRect().bottom - Number.parseFloat(getComputedStyle(scroller).paddingBottom || '0')
|
||||
: window.innerHeight - 12;
|
||||
const height = Math.max(300, bottom - top);
|
||||
rootStyle.value = { height: `${height}px`, flex: '1 1 100%' };
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user