reactjs - 如何通过history.push in react移动到顶部
问题描述
我使用 history.push 但这显示中间或底部或顶部或下一页的内容。
我想每次都把那个节目放在下一页的顶部。
请给我建议。
解决方案
您应该window.scrollTo(0, 0);
在 componentDidMount 中使用。
推荐阅读
- javascript - 获取 html 和 js 天气 api 请求以在节点中工作。在我上传到节点之前它可以工作
- python - PyQT5 标签的鼠标悬停事件
- laravel - 更新数据时出现 QueryException 错误
- python-3.x - InvalidArgumentError:您必须使用 dtype float 为占位符张量“Placeholder_56”提供一个值
- c# - 在 c#/WPF 中绑定子类 (DataContext = obj) (Binding subclass.var}
- c# - 在模型类中查找枚举类型
- java - 当我尝试调用此方法“setupWithViewPager()”时,我没有找到它
- java - 当两个按钮具有相同的 onAction 方法时,如何检查哪个按钮(在 fxml 中)调用了 controller.java 中的函数
- angular - 从第三个数组中的两个数组中过滤数据
- android-studio - 在 Android Studio 3.1.3 中,我的主题编辑器不显示我选择的任何主题的预览