自动滚到到顶部

This commit is contained in:
禺狨 2023-04-17 14:28:04 +08:00
parent a0754cde00
commit 76d3a939d2

View File

@ -1,7 +1,8 @@
import React from "react";
import { useLayoutEffect } from "react";
import { useLocation } from "react-router-dom";
const AutoScorllTop = ({ children }) => {
const AutoScorllTop: React.FC<{ children: any }> = ({ children }) => {
const location = useLocation();
useLayoutEffect(() => {
document.documentElement.scrollTo(0, 0);