在多页Dash应用中通过回调调用URL的实现方案咨询
多页Dash应用中通过开关触发页面跳转的回调问题
我正在寻找在多页Dash应用中通过开关调用链接/URL的方法,希望获取关于callback定义的建议。
初始实现思路
html.Div('old', style= {'display':'inline-block', 'float':'left'}), html.Div(dcc.Link(daq.BooleanSwitch(id='test-switch', on=False, style= {'display':'inline-block', 'float':'left', 'margin-left': '1px'}), href='/testURL')),
当前回调定义
@app.callback( Output('boolean-switch-output-1', 'children'), Input('test-switch', 'on') ) def render_url(flag): if flag == True: return '/testURL' # 无法成功跳转到/testURL
其中/testURL已在testURL.py中通过以下代码完成注册:
register_page(__name__, path='/testURL')
临时解决方案
目前我用以下方法作为临时方案:
html.Div('old', style= {'display':'inline-block', 'float':'left'}), html.Div(html.A(daq.BooleanSwitch(id='test-switch', on=False, style= {'display':'inline-block', 'float':'left', 'margin-left': '1px'}), href='/testURL', target='_blank'))
提前感谢您的解答。
内容的提问来源于stack exchange,提问作者dark.vador
相关产品推荐
相关产品推荐

