Replies: 2 comments 1 reply
-
Here's one possibility: from nicegui import context
context.get_client().page.path Or you ask the client: await ui.run_javascript('window.location.pathname') Or you use FastAPI's from fastapi import Request
@ui.page('/page')
def page(request: Request):
ui.notify(request.url.path) |
Beta Was this translation helpful? Give feedback.
1 reply
-
ui.context.client.page.path from nicegui import ui
@ui.page('/page')
def page():
ui.notify(ui.context.client.page.path) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
Is there a way to interrogate the current URL/path when inside the code.
As example:
If you take the menu-generation in the website of nicegui itself, suppose you want to color the currently visible menu in a different color. Is it possible to retrieve the current path, so you can apply a different styling for the item corresponding to the current page?
Thanks.
Stefaan
Beta Was this translation helpful? Give feedback.
All reactions