소스 검색

#791 fix display of text `0`

Falko Schindler 2 년 전
부모
커밋
c4f18b6fc3
2개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      nicegui/element.py
  2. 1 1
      nicegui/templates/index.html

+ 1 - 1
nicegui/element.py

@@ -41,7 +41,7 @@ class Element(Visibility):
         self._style: Dict[str, str] = {}
         self._props: Dict[str, Any] = {}
         self._event_listeners: Dict[str, EventListener] = {}
-        self._text: str = ''
+        self._text: Optional[str] = None
         self.slots: Dict[str, Slot] = {}
         self.default_slot = self.add_slot('default')
 

+ 1 - 1
nicegui/templates/index.html

@@ -104,7 +104,7 @@
               }));
             }
             const children = data.ids.map(id => renderRecursively(elements, id));
-            if (name === 'default' && element.text) {
+            if (name === 'default' && element.text !== null) {
               children.unshift(element.text);
             }
             return [ ...rendered, ...children]