本文整理匯總了Python中dash_core_components.Link方法的典型用法代碼示例。如果您正苦於以下問題:Python dash_core_components.Link方法的具體用法?Python dash_core_components.Link怎麽用?Python dash_core_components.Link使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dash_core_components
的用法示例。
在下文中一共展示了dash_core_components.Link方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: display_page
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Link [as 別名]
def display_page(pathname):
return html.Div([
html.Div([
html.Span(
dcc.Link(link_mapping['/'], href="/") if pathname != '/' else 'Exhibit A',
style=styles['link']
),
html.Span(
dcc.Link(link_mapping['/exhibit-b'], href="/exhibit-b") if pathname != '/exhibit-b' else 'Exhibit B',
style=styles['link']
),
html.Span(
dcc.Link(link_mapping['/exhibit-c'], href="/exhibit-c") if pathname != '/exhibit-c' else 'Exhibit C',
style=styles['link']
)
]),
dcc.Markdown('### {}'.format(link_mapping[pathname])),
])
示例2: display_page
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Link [as 別名]
def display_page(pathname):
print(pathname)
if pathname == '/':
return html.Div([
html.Div('You are on the index page.'),
# the dcc.Link component updates the `Location` pathname
# without refreshing the page
dcc.Link(html.A('Go to page 2 without refreshing!'), href="/page-2", style={'color': 'blue', 'text-decoration': 'none'}),
html.Hr(),
html.A('Go to page 2 but refresh the page', href="/page-2")
])
elif pathname == '/page-2':
return html.Div([
html.H4('Welcome to Page 2'),
dcc.Link(html.A('Go back home'), href="/"),
])
else:
return html.Div('I guess this is like a 404 - no content available')
# app.css.append_css({"external_url": "https://codepen.io/chriddyp/pen/bWLwgP.css"})
示例3: create_backlinks
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Link [as 別名]
def create_backlinks(pathname):
parts = pathname.strip('/').split('/')
links = [
dcc.Link('Home', href='/')
]
for i, part in enumerate(parts[:-1]):
href='/' + '/'.join(parts[:i + 1])
name = chapter_index.URL_TO_BREADCRUMB_MAP.get(href, '? {} ?'.format(href))
links += [
html.Span(' > '),
dcc.Link(name, href=href)
]
current_chapter_name = chapter_index.URL_TO_BREADCRUMB_MAP.get(
pathname.rstrip('/'), '? {} ?'.format(pathname)
)
links += [html.Span(' > ' + current_chapter_name)]
return links
示例4: Chapter
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Link [as 別名]
def Chapter(name, href=None, caption=None):
linkComponent = html.A if href.startswith('http') else dcc.Link
return html.Div(className='toc--chapter', children=[
html.Li(
linkComponent(
name,
href=relpath(href),
id=href,
className='toc--chapter-link'
),
),
html.Small(
className='toc--chapter-content',
children=Markdown(caption or ''),
style={
'display': 'block',
'marginTop': '-10px' if caption else ''
}
) if caption else None
])
示例5: get_menu
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Link [as 別名]
def get_menu():
menu = html.Div([
dcc.Link('Overview ', href='/overview', className="tab first"),
dcc.Link('Price Performance ', href='/price-performance', className="tab"),
dcc.Link('Portfolio & Management ', href='/portfolio-management', className="tab"),
dcc.Link('Fees & Minimums ', href='/fees', className="tab"),
dcc.Link('Distributions ', href='/distributions', className="tab"),
dcc.Link('News & Reviews ', href='/news-and-reviews', className="tab")
], className="row ")
return menu
## Page layouts
示例6: Sidebar
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Link [as 別名]
def Sidebar(urls, depth=0):
chapters = []
for chapter in urls:
try:
if 'chapters' in chapter and not chapter.get('hide_chapters_in_sidebar', False):
chapters.append(Collapsible(
chapter['name'],
Sidebar(chapter['chapters'], depth+1),
chapter.get('description', None)
))
else:
title = ''
if isinstance(chapter.get('description'), str):
title = dedent(chapter['description']).strip()
elif isinstance(chapter.get('description_short'), str):
title = dedent(chapter['description_short']).strip()
chapters.append(html.Div(
dcc.Link(
chapter['name'],
href=chapter['url'].rstrip('/'),
),
className='link',
**(
{'title': title}
if not title == '' else {}
)
))
except Exception as e:
print(e)
return html.Div(
className='sidebar sidebar--{}'.format(depth),
children=chapters
)
示例7: make_brand
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Link [as 別名]
def make_brand(**kwargs):
return html.Header(
className="brand",
children=dcc.Link(
href=get_url(""),
children=html.H1([fa("far fa-chart-bar"), server.config["TITLE"]]),
),
**kwargs,
)
示例8: get_logo
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Link [as 別名]
def get_logo():
logo = html.Div([
html.Div([
html.Img(src='http://logonoid.com/images/vanguard-logo.png', height='40', width='160')
], className="ten columns padded"),
html.Div([
dcc.Link('Full View ', href='/full-view')
], className="two columns page-view no-print")
], className="row gs-header")
return logo