فهرست منبع

provide demo on how to replace content in a dialog

Rodja Trappe 2 سال پیش
والد
کامیت
8ec1ce6e7d
1فایلهای تغییر یافته به همراه16 افزوده شده و 0 حذف شده
  1. 16 0
      website/more_documentation/dialog_documentation.py

+ 16 - 0
website/more_documentation/dialog_documentation.py

@@ -29,3 +29,19 @@ def more() -> None:
             ui.notify(f'You chose {result}')
 
         ui.button('Await a dialog', on_click=show)
+
+    @text_demo('Replacing content', '''
+        The content of a dialog can be changed.
+    ''')
+    def replace_content():
+        def replace():
+            dialog.clear()
+            with dialog, ui.card().classes('w-64 h-64'):
+                ui.label('New Content')
+            dialog.open()
+
+        with ui.dialog() as dialog, ui.card():
+            ui.label('Hello world!')
+
+        ui.button('Open', on_click=dialog.open)
+        ui.button('Replace', on_click=replace)