|
|
@@ -6,15 +6,13 @@ const useAutoTable = (collapsed) => {
|
|
|
const needSubtractWidth = (collapsed ? 208 : 48) + 48 + 48 + 48// 需要被裁掉的高度
|
|
|
|
|
|
|
|
|
- const [scroll, setScroll] = useState({ x: 0, y: 0 })
|
|
|
+ const [scroll, setScroll] = useState({ x: document.body.clientWidth - needSubtractWidth, y: document.body.clientHeight - needSubtractHeight })
|
|
|
|
|
|
useEffect(() => {
|
|
|
- setScroll({ ...scroll, x: document.body.clientWidth - needSubtractWidth, y: document.body.clientHeight - needSubtractHeight })
|
|
|
- window.addEventListener('resize', () => {
|
|
|
- setScroll({ ...scroll, x: document.body.clientWidth - needSubtractWidth, y: document.body.clientHeight - needSubtractHeight })
|
|
|
- })
|
|
|
+ const handleScroll = () => setScroll({ ...scroll, x: document.body.clientWidth - needSubtractWidth, y: document.body.clientHeight - needSubtractHeight })
|
|
|
+ window.addEventListener('resize', handleScroll)
|
|
|
return () => {
|
|
|
- window.removeEventListener('resize', () => { })
|
|
|
+ window.removeEventListener('resize', handleScroll)
|
|
|
}
|
|
|
}, [collapsed])
|
|
|
|