瀏覽代碼

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

visuddhinanda 3 年之前
父節點
當前提交
bb871073b9
共有 1 個文件被更改,包括 4 次插入0 次删除
  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";
 import type { IAnthologyData } from "./AnthologyCard";
 import TocTree from "./TocTree";
+import { useNavigate } from "react-router-dom";
 
 const { Title, Text } = Typography;
 
@@ -34,6 +35,7 @@ interface IWidgetAnthologyDetail {
 }
 const Widget = ({ aid, channels, onArticleSelect }: IWidgetAnthologyDetail) => {
   const [tableData, setTableData] = useState(defaultData);
+  const navigate = useNavigate();
 
   useEffect(() => {
     console.log("useEffect");
@@ -83,6 +85,8 @@ const Widget = ({ aid, channels, onArticleSelect }: IWidgetAnthologyDetail) => {
         onSelect={(keys: string[]) => {
           if (typeof onArticleSelect !== "undefined") {
             onArticleSelect(keys);
+          } else {
+            navigate(`/article/article/${keys[0]}/read`);
           }
         }}
       />