繁体   English   中英

是否可以将整个页面宽度放入滚动条反应?

[英]Is it possible to put full page width to scrollbar-react?

我正在制作一个带有侧边栏和一个待办事项页面的待办事项应用程序。 我想让页面高度全屏而不是固定高度。

可以用 simplebar-react 做到这一点吗?

在 React 中使用useLayoutEffect() ,更新的最终代码应该是这样的:

const [dimensions, setDimensions] = useState([0, 0]);

useLayoutEffect(() => {
  function updateSize() {
    setDimensions([window.innerWidth, window.innerHeight]);
  }
  window.addEventListener("resize", updateSize);
  updateSize();
  return () => window.removeEventListener("resize", updateSize);
}, []);

然后调用尺寸来获取高度和宽度。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM