fix(ui): 页面补通道卡片骨架,白卡与分页恢复正常
- App 不统一包卡片(会与页面级卡片叠加),改由各页面根节点提供,与 Notice 一致 - 25 个视图套 .page-wrapper.yh-fill > .main-container;日志管理重写为 .search-wrap + .table-region + .page-panel 规范结构(卡片自动转 flex 纵向) - 新增 element_height mixin:ResizeObserver 实测 .table-region 高度喂 Table, 替代视口高度减常量的旧模型 - self_viewport 高度基准扣除卡片留白 64px,避免表格溢出被卡片裁切 - .env.dev 恢复真实后端地址
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 卡片内表格高度实测(Vue3)
|
||||
* 用法:mixin + 在表格容器上写 class="table-region" ref="tableRegion"
|
||||
* Table 用 :height="tableRegionHeight"
|
||||
*/
|
||||
export const element_height = {
|
||||
data() {
|
||||
return {
|
||||
tableRegionHeight: 0,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.__measureTableRegion();
|
||||
if (typeof ResizeObserver !== "undefined") {
|
||||
this.__tableRegionRO = new ResizeObserver(() => this.__measureTableRegion());
|
||||
const el = this.$refs.tableRegion;
|
||||
if (el) this.__tableRegionRO.observe(el);
|
||||
}
|
||||
window.addEventListener("resize", this.__measureTableRegion);
|
||||
},
|
||||
beforeUnmount() {
|
||||
if (this.__tableRegionRO) {
|
||||
this.__tableRegionRO.disconnect();
|
||||
this.__tableRegionRO = null;
|
||||
}
|
||||
window.removeEventListener("resize", this.__measureTableRegion);
|
||||
},
|
||||
methods: {
|
||||
__measureTableRegion() {
|
||||
const el = this.$refs.tableRegion;
|
||||
if (!el) return;
|
||||
const h = Math.floor(el.clientHeight);
|
||||
// 0 常见于隐藏容器/首帧,保留上次有效值
|
||||
if (h > 0) this.tableRegionHeight = h;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default element_height;
|
||||
@@ -1,3 +1,6 @@
|
||||
// 卡片留白预算(通道 §4.4):.main-container 上下各 16 外边距 + 16 内边距
|
||||
const CARD_OVERHEAD = 64;
|
||||
|
||||
export const self_viewport = {
|
||||
data() {
|
||||
return {
|
||||
@@ -26,11 +29,16 @@ export const self_viewport = {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.tableHeight = document.body.clientHeight;
|
||||
window.onresize = () => {
|
||||
return (() => {
|
||||
this.tableHeight = document.body.clientHeight;
|
||||
})();
|
||||
const sync = () => {
|
||||
// 页面已包在 .main-container 卡片内:从视口高度里扣掉卡片留白,
|
||||
// 否则沿用旧视口基准会多算 64px,表格溢出被卡片裁切
|
||||
this.tableHeight = document.body.clientHeight - CARD_OVERHEAD;
|
||||
};
|
||||
sync();
|
||||
window.addEventListener("resize", sync);
|
||||
this.__syncTableHeight = sync;
|
||||
},
|
||||
beforeUnmount() {
|
||||
if (this.__syncTableHeight) window.removeEventListener("resize", this.__syncTableHeight);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user