Skip to content

Commit

Permalink
show first page on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
rodja committed Sep 5, 2023
1 parent cb4c4fc commit 26152a5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/single_page_app/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python3
from router import Router

from nicegui import ui
from nicegui import Client, ui


@ui.page('/') # normal index page (e.g. the entry point of the app)
@ui.page('/{_:path}') # all other pages will be handled by the router but must be registered to also show the SPA index page
def main():
async def main(client: Client):
router = Router()

@router.add('/')
Expand All @@ -29,6 +29,8 @@ def show_three():

# this places the content which should be displayed
router.frame().classes('w-full p-4 bg-gray-100')
await client.connected()
router.open(show_one) # this is the default page


ui.run()

0 comments on commit 26152a5

Please sign in to comment.