📌  相关文章
📜  在调整大小时获取窗口大小 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:13.861000             🧑  作者: Mango

代码示例1
useEffect(() =>{
    let windowLength = document.documentElement.clientWidth || window.innerWidth;
    setWindowSize(windowLength);
  },[])
  console.log("onload is calling",windowSize);
  window.onresize= ()=>{
  let windowLength = document.documentElement.clientWidth || window.innerWidth;
  setWindowSize(windowLength);
  }