Sfoglia il codice sorgente

点击文章,跳转到文章阅读

visuddhinanda 3 anni fa
parent
commit
bb871073b9
1 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  1. 4 0
      dashboard/src/components/article/AnthologyDetail.tsx

+ 4 - 0
dashboard/src/components/article/AnthologyDetail.tsx

@@ -9,6 +9,7 @@ import type {
 } from "../api/Article";
 } from "../api/Article";
 import type { IAnthologyData } from "./AnthologyCard";
 import type { IAnthologyData } from "./AnthologyCard";
 import TocTree from "./TocTree";
 import TocTree from "./TocTree";
+import { useNavigate } from "react-router-dom";
 
 
 const { Title, Text } = Typography;
 const { Title, Text } = Typography;
 
 
@@ -34,6 +35,7 @@ interface IWidgetAnthologyDetail {
 }
 }
 const Widget = ({ aid, channels, onArticleSelect }: IWidgetAnthologyDetail) => {
 const Widget = ({ aid, channels, onArticleSelect }: IWidgetAnthologyDetail) => {
   const [tableData, setTableData] = useState(defaultData);
   const [tableData, setTableData] = useState(defaultData);
+  const navigate = useNavigate();
 
 
   useEffect(() => {
   useEffect(() => {
     console.log("useEffect");
     console.log("useEffect");
@@ -83,6 +85,8 @@ const Widget = ({ aid, channels, onArticleSelect }: IWidgetAnthologyDetail) => {
         onSelect={(keys: string[]) => {
         onSelect={(keys: string[]) => {
           if (typeof onArticleSelect !== "undefined") {
           if (typeof onArticleSelect !== "undefined") {
             onArticleSelect(keys);
             onArticleSelect(keys);
+          } else {
+            navigate(`/article/article/${keys[0]}/read`);
           }
           }
         }}
         }}
       />
       />