Bläddra i källkod

meaning 为 undefine 显示为 ""

visuddhinanda 2 år sedan
förälder
incheckning
af0765d112
1 ändrade filer med 8 tillägg och 11 borttagningar
  1. 8 11
      dashboard/src/components/template/Wbw/RelaGraphic.tsx

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

@@ -23,17 +23,14 @@ const RelaGraphicWidget = ({ wbwData }: IWidget) => {
             const localName = terms?.find(
               (item) => item.word === relation.relation
             )?.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("");
         } else {