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:
personal82555 committed 2026-10-15 11:18:54 +08:00
1 parent 7aeb8b74ef
commit 311ab1b139
14 files changed
+124 -27

No files matched your search

+22
View File
@@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file. See [standa
## Version 2026.10.14-it-tools-pro
### 🦶 功能页页脚改为独立底栏:显示在功能区外、且不产生滚动条
- **上一版遗留的两个问题**:
1. **页脚压住内容**:`/json-prettify` 的底部工具行(中文转Unicode / 添加转义 / Dict转Json…)在 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 个"撑满视口"工具**的高度改为按**滚动区底边**计算,不再用 `window.innerHeight`:
`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`
```js
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);
```
这样工具自身高度随底栏自动收缩,**不会再撑到页脚下面**
- **验证(20 个功能页)**:`fixed` ✓、**页脚在滚动区之外**(856 < 869)✓、**滚到底零遮挡**(余量 13–421px)✓
- **滚动条消失**:`/json-prettify`、`/barcode-batch-generator`、`/label-designer`、`/translator`、`/image-ocr`、`/pdf-ocr`、`/doc-convert`、`/pdf-tools`、`/image-tools`、`/code-reader`、`/site-bookmarks`、`/ai-retouch` 全部由"有"变"无"
- 仅内容本身超长的 4 个页面保留滚动条(`/ai-chat`、`/emoji-picker`、`/text-to-image`、`/encryption`),底部同样不被遮挡
- 视觉核验:`/json-prettify` 底部工具行完整可见、未被页脚压住、与页脚有清晰分隔
- **注**:侧边栏的 `padding-bottom: 200px` 不产生滚动条(滚动内容在该 padding 之外),无需处理
### 🦶 功能页页脚固定在底部 + 修掉功能页的多余滚动条
- **问题**:上一版页脚改为流内元素后,功能页出现**莫名其妙的滚动条** —— 实测根因是页脚在内容流内占位(`margin-top 40 + 高 41 = 81px`),把"内容刚好一屏"的功能页(内容高 848 / 可视 900)顶出 27px 溢出。实测 `/hash-text`:溢出 27px,**隐藏页脚后 = 0**,页脚是唯一成因
- **改法**:给 `BaseLayout` 加 `fixedFooter` 开关,功能页(`tool.layout.vue` → `<BaseLayout fixed-footer>`)页脚 `position: fixed` 固定视口底部;首页等仍为流内最底部
+6 -3
View File
@@ -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),通栏贴顶遮挡滚动内容
+8 -2
View File
@@ -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%' };
}
+8 -2
View File
@@ -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%' };
}
+8 -2
View File
@@ -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%' };
}
+8 -2
View File
@@ -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%' };
}
+8 -2
View File
@@ -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%' };
}
+8 -2
View File
@@ -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%' };
}
+8 -2
View File
@@ -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);
}
+8 -2
View File
@@ -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%' };
}
+8 -2
View File
@@ -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%' };
}
+8 -2
View File
@@ -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%' };
}
+8 -2
View File
@@ -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%' };
}