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
@@ -256,7 +256,8 @@ onBeforeUnmount(() => {
|
||||
}
|
||||
}
|
||||
|
||||
// 功能页:固定在视口底部居中;不再占据文档流,因此不会把"刚好一屏"的页面顶出滚动条
|
||||
// 功能页:固定在视口底部居中,且滚动区为其预留一条独立底栏(见 MenuLayout 的 height 规则),
|
||||
// 因此既不占文档流(不会把"刚好一屏"的页面顶出滚动条),也不会压在工具内容之上
|
||||
&.fixed {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
@@ -273,9 +274,11 @@ onBeforeUnmount(() => {
|
||||
}
|
||||
}
|
||||
|
||||
/* 功能页:内容底部留出页脚高度,避免滚到底时页脚压住最后一块内容 */
|
||||
// 功能页:内容滚动区高度 = 100% - 底栏(44px),让页脚显示在功能区域外面,且不产生滚动条
|
||||
// (注意:不能用 padding-bottom 留白,那会把"刚好一屏"的页面顶出滚动条)
|
||||
.menu-layout.fixed-footer :deep(.content .n-layout-scroll-container) {
|
||||
padding-bottom: 56px;
|
||||
height: calc(100% - 44px);
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
// 顶部导航:滚动时固定在最顶部(sticky),通栏贴顶遮挡滚动内容
|
||||
|
||||
@@ -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