📌  相关文章
📜  反应如何滚动到元素 - Javascript代码示例

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

代码示例2
class ReadyToScroll extends Component {

    constructor(props) {
        super(props)
        this.myRef = React.createRef()  
    }

    render() {
        return 
} scrollToMyRef = () => window.scrollTo(0, this.myRef.current.offsetTop) // run this method to execute scrolling. }