1.获取节点距离顶部的高度 let t =document.querySelector('.last_box').offsetTop 2.滚动到当前元素的位置 window.scroll({ top: t, left: 0, behavior: 'smooth' })