- 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 恢复真实后端地址
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
/**
|
||
* 卡片内表格高度实测(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;
|