Procházet zdrojové kódy

hide q-notify view (element should not occupy space) and remove it afterwards (DOM should not grow with every notification)

Falko Schindler před 2 roky
rodič
revize
f769a6aa22
1 změnil soubory, kde provedl 2 přidání a 0 odebrání
  1. 2 0
      nicegui/elements/notify.py

+ 2 - 0
nicegui/elements/notify.py

@@ -18,9 +18,11 @@ class Notify(Element):
         view = jp.QNotify(message=message, position=position, closeBtn=close_button, temp=False)
         view = jp.QNotify(message=message, position=position, closeBtn=close_button, temp=False)
 
 
         super().__init__(view)
         super().__init__(view)
+        self.visible = False
         create_task(self.notify_async(), name='notify_async')
         create_task(self.notify_async(), name='notify_async')
 
 
     async def notify_async(self):
     async def notify_async(self):
         self.view.notify = True
         self.view.notify = True
         await self.parent_view.update()
         await self.parent_view.update()
         self.view.notify = False
         self.view.notify = False
+        self.parent_view.remove_component(self.view)