[英]Navigation Bar Dash to Flask
I am trying to create a Flask application and have a page which would have the Dash application.我正在尝试创建一个 Flask 应用程序并有一个包含 Dash 应用程序的页面。 The Flask application would have a the below pages
Flask 应用程序将具有以下页面
Home (/)
Login (/login)
Logout (/logout)
Dashboard (/dashboard)
Only the /dashboard is the Dash application which is redirected from the Login page post authentication.只有 /dashboard 是 Dash 应用程序,它是从登录页面后身份验证重定向的。 Everything works fine.
一切正常。
But I need to have Navigation bar from the /dashboard to go back to the Flask application Pages.但我需要将导航栏从 /dashboard 到 go 返回到 Flask 应用程序页面。
dbc.NavbarSimple(
children=[
dbc.NavItem(dbc.NavLink("Home", href="/")),
dbc.NavItem(dbc.NavLink("Logout", href="/logout")),
dbc.NavItem(dbc.NavLink("Dashboard", href="/dashboard")),
],
brand="NavbarSimple",
brand_href="#",
color="primary",
dark=True,
)
I tried with the above code and I get the Navigation Bar.我尝试使用上面的代码,我得到了导航栏。 If I hover my mouse over the links I get the proper links like " http://127.0.0.1:5000/logout " and if i click on the link, the link on the URL in the browser is changing as well.
如果我 hover 将鼠标悬停在链接上,我会得到正确的链接,例如“ http://127.0.0.1:5000/logout ”,如果我单击该链接,则 ZE6B391A8ZD2C4D45903D 上的链接也将更改为 58902A But the page never loads and stuck on the same dashboard page.
但是该页面永远不会加载并停留在同一个仪表板页面上。
Has anyone faced a similar issue?有没有人遇到过类似的问题? I'm using Chrome and tried on IE as well.
我正在使用 Chrome 并在 IE 上尝试过。
I got it working by just making a simple change of setting external link as True.我只需将外部链接设置为 True 就可以正常工作。 Adding my answer in case anyone else is stuck at the same issue I faced.
添加我的答案,以防其他人遇到我面临的同样问题。
dbc.NavbarSimple(
children=[
dbc.NavItem(dbc.NavLink("Home", href="/", external_link=True)),
dbc.NavItem(dbc.NavLink("Logout", href="/logout", external_link=True)),
dbc.NavItem(dbc.NavLink("Dashboard", href="/dashboard", external_link=True)),
],
brand="NavbarSimple",
brand_href="#",
color="primary",
dark=True,
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.