Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在第 1 页,我滚动页面的一半,然后单击一个链接,通过 Angular 路由器将我带到第 2 页。当我点击“后退”按钮时,我希望将第 1 页向下滚动一半,就像我离开该页面之前一样。
最简单的方法是什么?
保存到localStorage滚动位置ngOnDestroy(),并恢复到ngOnInit()
localStorage
ngOnDestroy()
ngOnInit()