Browse Source

path长度>0获取书名

visuddhinanda 2 years ago
parent
commit
ac405a6f69
1 changed files with 4 additions and 1 deletions
  1. 4 1
      dashboard/src/components/article/TypePali.tsx

+ 4 - 1
dashboard/src/components/article/TypePali.tsx

@@ -142,7 +142,10 @@ const TypePaliWidget = ({
             onLoad(json.data);
           }
           if (typeof onTitle !== "undefined") {
-            const bookTitle = json.data.path ? json.data.path[0].title : "";
+            const bookTitle =
+              json.data.path && json.data.path.length > 0
+                ? json.data.path[0].title
+                : "";
             onTitle(`${bookTitle}-${json.data.title}`);
           }
         } else {