Rodja Trappe 2 rokov pred
rodič
commit
703d55c49a

+ 0 - 0
examples/modularization/c.py → examples/modularization/example_c.py


+ 2 - 2
examples/modularization/example_pages.py

@@ -6,11 +6,11 @@ from nicegui import ui
 def create() -> None:
 
     @ui.page('/a')
-    def example_page():
+    def example_page_a():
         with theme.frame('- Example A -'):
             ui.label('Example A').classes('text-h4 text-grey-8')
 
     @ui.page('/b')
-    def example_page():
+    def example_page_b():
         with theme.frame('- Example B -'):
             ui.label('Example B').classes('text-h4 text-grey-8')

+ 3 - 2
examples/modularization/main.py

@@ -1,5 +1,5 @@
 #!/usr/bin/env python3
-import c
+import example_c
 import example_pages
 import home_page
 import theme
@@ -17,6 +17,7 @@ def index_page() -> None:
 # this call shows that you can also move the whole page creation into a separate file
 example_pages.create()
 
-app.include_router(c.router)
+# we can also use the APIRouter as described in https://fastapi.tiangolo.com/tutorial/bigger-applications/?h=apirouter#apirouter
+app.include_router(example_c.router)
 
 ui.run(title='Modularization Example')