From f94f841c040c4df517eae11c56885ade1a927fca Mon Sep 17 00:00:00 2001 From: zhangyongtian <1181606322@qq.com> Date: Thu, 12 Sep 2024 16:06:00 +0800 Subject: [PATCH] style: 表格样式问题 --- gz-customerSystem/src/components/TableView/index.jsx | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gz-customerSystem/src/components/TableView/index.jsx b/gz-customerSystem/src/components/TableView/index.jsx index 085038b..b2cffcb 100644 --- a/gz-customerSystem/src/components/TableView/index.jsx +++ b/gz-customerSystem/src/components/TableView/index.jsx @@ -33,6 +33,7 @@ rowClassName, offsetHeight = 0,//高度偏移量 tableHeight,//自定义表格高度 + isScroll = false,//表格是否竖向滚动,兼容以前的,当需要表格竖向滚动,请设置这个 ...other }) => { // 80 ['类型','登记人','调解员','承办法官','调解员','签收人','退回人','处理时限','调解进度/司法确认进度','其他调解员','申请渠道','司法确认结果','助理/书记员','调解类型'] @@ -147,7 +148,7 @@ }); const scrollRef = useRef(null) - const [height, setHeight] = useState(500);//表格高度 + const [height, setHeight] = useState();//表格高度 useEffect(() => { onWindowResize() @@ -160,11 +161,15 @@ }, []) const onWindowResize = () => { - let offsetTop = 0; - if (scrollRef && scrollRef.current) { - offsetTop = getOffset(scrollRef.current).top; + if (tableHeight) { + setHeight(tableHeight) + } else { + let offsetTop = 0; + if (scrollRef && scrollRef.current) { + offsetTop = getOffset(scrollRef.current).top; + } + setHeight(getSize().windowH - offsetTop - 46 - offsetHeight) } - setHeight(getSize().windowH - offsetTop - 46 - offsetHeight) }; return ( @@ -207,7 +212,7 @@ bordered={bordered} rowSelection={rowSelection} scroll={{ - y: height - 80, + y: isScroll ? height - 80 : null, ...scroll }} expandable={expandable} -- Gitblit v1.8.0