如何在缩放后获取图像的宽度和高度&呈现react组件
发布于 2021-05-18 06:17:04
// equivalent to componentDidMount
useEffect(() => {
const height = document.getElementById("myImg").clientHeight
const width =document.getElementById("myImg").clientWidth
// update the state
}, [])我不知道为什么你要得到的宽度和高度后,渲染,这听起来不像是一件好事。
https://stackoverflow.com/questions/67580811
复制相似问题