-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create example & update docs for multi-page navigation
- Loading branch information
1 parent
7077e7d
commit e3e6191
Showing
3 changed files
with
40 additions
and
2 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from mesop.examples.docs import counter as counter | ||
from mesop.examples.docs import hello_world as hello_world | ||
from mesop.examples.docs import loading as loading | ||
from mesop.examples.docs import multi_page_nav as multi_page_nav | ||
from mesop.examples.docs import streaming as streaming |
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,23 @@ | ||
import mesop as me | ||
|
||
|
||
def on_click(e: me.ClickEvent): | ||
state = me.state(State) | ||
state.count += 1 | ||
me.navigate("/multi_page_nav/page_2") | ||
|
||
|
||
@me.page(path="/multi_page_nav") | ||
def main_page(): | ||
me.button("Navigate to Page 2", on_click=on_click) | ||
|
||
|
||
@me.page(path="/multi_page_nav/page_2") | ||
def page_2(): | ||
state = me.state(State) | ||
me.text(f"Page 2 - count: {state.count}") | ||
|
||
|
||
@me.stateclass | ||
class State: | ||
count: int |