瀏覽代碼

export scrollToTop

visuddhinanda 2 年之前
父節點
當前提交
d91964e521
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      dashboard/src/pages/library/article/show.tsx

+ 5 - 3
dashboard/src/pages/library/article/show.tsx

@@ -54,6 +54,10 @@ import PrPull from "../../../components/corpus/PrPull";
 import NotificationIcon from "../../../components/notification/NotificationIcon";
 import SentCart from "../../../components/template/SentEdit/SentCart";
 
+export const scrollToTop = () => {
+  document.getElementById("article-root")?.scrollIntoView();
+};
+
 export interface ISearchParams {
   key: string;
   value: string;
@@ -141,9 +145,7 @@ const Widget = () => {
   }, [currMode]);
 
   console.log(anchorNavOpen, anchorNavShow);
-  const scrollToTop = () => {
-    document.getElementById("article-root")?.scrollIntoView();
-  };
+
   return (
     <div id="article-root">
       <Affix offsetTop={0}>