mirror of
https://github.com/PlayEdu/h5.git
synced 2025-06-25 08:02:48 +08:00
14 lines
373 B
TypeScript
14 lines
373 B
TypeScript
import React from "react";
|
|
import { useLayoutEffect } from "react";
|
|
import { useLocation } from "react-router-dom";
|
|
|
|
const AutoScorllTop: React.FC<{ children: any }> = ({ children }) => {
|
|
const location = useLocation();
|
|
useLayoutEffect(() => {
|
|
document.documentElement.scrollTo(0, 0);
|
|
}, [location.pathname]);
|
|
return children;
|
|
};
|
|
|
|
export default AutoScorllTop;
|