Procházet zdrojové kódy

meaning 为 undefine 显示为 ""

visuddhinanda před 2 roky
rodič
revize
af0765d112

+ 8 - 11
dashboard/src/components/template/Wbw/RelaGraphic.tsx

@@ -23,17 +23,14 @@ const RelaGraphicWidget = ({ wbwData }: IWidget) => {
             const localName = terms?.find(
             const localName = terms?.find(
               (item) => item.word === relation.relation
               (item) => item.word === relation.relation
             )?.meaning;
             )?.meaning;
-            return `${relation.sour_id}(${
-              relation.sour_spell
-            }<br />${item.meaning?.value
-              ?.replaceAll("[", "")
-              .replaceAll("]", "")
-              .replaceAll("{", "")
-              .replaceAll("}", "")}) --"${
-              relation.relation
-            }<br />${localName}"--> ${relation.dest_id}(${
-              relation.dest_spell
-            })\n`;
+            const meaning = item.meaning?.value
+              ? item.meaning?.value
+                  ?.replaceAll("[", "")
+                  .replaceAll("]", "")
+                  .replaceAll("{", "")
+                  .replaceAll("}", "")
+              : "";
+            return `${relation.sour_id}(${relation.sour_spell}<br />${meaning}) --"${relation.relation}<br />${localName}"--> ${relation.dest_id}(${relation.dest_spell})\n`;
           });
           });
           return graphic.join("");
           return graphic.join("");
         } else {
         } else {