在我的角形6应用程序中,当我向下滚动一个页面并单击页面底部的链接时,它确实改变了路线,并带我进入下一页,但它没有滚动到页面的顶部。因此,如果第一页(父母)很长,第二页(子)内容很少,就会给人一种印象,认为第二页缺乏内容。因为只有当用户滚动到页面顶部时,内容才是可见的。
我试着给孩子加"scrollPositionRestoration“,
@NgModule({
imports: [RouterModule.forChild(routes, {
scrollPositionRestoration: 'top'
})],
exports: [RouterModule]
})这给了我错误,因为:
(property) scrollPositionRestoration: string
Expected 1 arguments, but got 2.如何解决这个问题?有任何想法滚动页面顶部的角子组件吗?
发布于 2022-11-11 21:57:51
html {
height: 100%;
}
body {
height: 100%;
overflow: auto;
}https://stackoverflow.com/questions/61767796
复制相似问题