Explorar o código

Merge pull request #1397 from visuddhinanda/agile

社区字典显示判断规则_data.editor.length > 0
visuddhinanda %!s(int64=2) %!d(string=hai) anos
pai
achega
71b657e4f7
Modificáronse 1 ficheiros con 4 adicións e 3 borrados
  1. 4 3
      dashboard/src/components/dict/Community.tsx

+ 4 - 3
dashboard/src/components/dict/Community.tsx

@@ -49,9 +49,7 @@ const CommunityWidget = ({ word }: IWidget) => {
           console.log("dict community", json.message);
           return;
         }
-        if (json.data.count > 0) {
-          setLoaded(true);
-        }
+
         let meaning = new Map<string, number>();
         let grammar = new Map<string, number>();
         let parent = new Map<string, number>();
@@ -121,6 +119,9 @@ const CommunityWidget = ({ word }: IWidget) => {
         });
         _data.editor.sort((a, b) => b.score - a.score);
         setWordData(_data);
+        if (_data.editor.length > 0) {
+          setLoaded(true);
+        }
       })
       .catch((error) => {
         console.error(error);