Explorar el Código

点击目录跳转

visuddhinanda hace 2 años
padre
commit
a19a29b60e
Se han modificado 1 ficheros con 14 adiciones y 1 borrados
  1. 14 1
      dashboard/src/pages/library/article/show.tsx

+ 14 - 1
dashboard/src/pages/library/article/show.tsx

@@ -1,5 +1,6 @@
 import { Affix, Divider, Space } from "antd";
 import { Header } from "antd/lib/layout/layout";
+import { Key } from "antd/lib/table/interface";
 import { useEffect, useState } from "react";
 import { useNavigate, useParams, useSearchParams } from "react-router-dom";
 import { IApiResponseDictList } from "../../../components/api/Dict";
@@ -113,7 +114,19 @@ const Widget = () => {
           >
             <div>
               <Space direction="vertical">
-                <ToolButtonToc type={type} articleId={id} />
+                <ToolButtonToc
+                  type={type as ArticleType}
+                  articleId={id}
+                  onSelect={(key: Key) => {
+                    console.log("toc click", key);
+                    let url = `/article/${type}/${key}?`;
+                    let param: string[] = [];
+                    searchParams.forEach((value, key) => {
+                      param.push(`${key}=${value}`);
+                    });
+                    navigate(url + param.join("&"));
+                  }}
+                />
                 <ToolButtonTag type={type} articleId={id} />
                 <ToolButtonPr type={type} articleId={id} />
                 <ToolButtonDiscussion type={type} articleId={id} />