forked from zauberzeug/nicegui
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
60 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from nicegui import ui | ||
|
||
from . import doc | ||
|
||
|
||
@doc.demo(ui.outlet) | ||
def main_demo() -> None: | ||
@ui.outlet('/spa') | ||
def spa_app_outlet(): | ||
with ui.header() as header: | ||
ui.label('Simple Single Page App').classes('text-2xl') | ||
yield {'header': header} | ||
ui.label('A footer added to each view.') | ||
|
||
@spa_app_outlet.view('/', title="Home") | ||
def spa_index(header): | ||
ui.label('This is the home page of the Single Page App.') | ||
ui.button('Toggle header', on_click=lambda: header.toggle()) | ||
ui.link('Go to other page', other_spa_page) | ||
|
||
@spa_app_outlet.view('/other', title="Other Page") | ||
def other_spa_page(): | ||
ui.label("Another page sharing the same layout.") | ||
ui.link('Go to index page', spa_index) | ||
ui.button("Navigate back", on_click=lambda: ui.navigate.back()) | ||
|
||
ui.link('Open Single Page App', "/spa") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters