Sfoglia il codice sorgente

provide demo for linking to another page

Rodja Trappe 2 anni fa
parent
commit
a952e65981
1 ha cambiato i file con 12 aggiunte e 0 eliminazioni
  1. 12 0
      website/more_documentation/link_documentation.py

+ 12 - 0
website/more_documentation/link_documentation.py

@@ -31,3 +31,15 @@ def more() -> None:
             ui.link('Goto A', '#target_A')
             # ui.link('Goto B', label_B)
             ui.link('Goto B', '#target_B')  # HIDE
+
+    @text_demo('Links to other pages', '''
+        You can link to other pages by providing the link target as path or function reference.
+    ''')
+    def link_to_other_page():
+        @ui.page('/some_other_page')
+        def my_page():
+            ui.label('This is another page')
+
+        ui.label('Go to other page')
+        ui.link('... with path', '/some_other_page')
+        ui.link('... with function reference', my_page)