Dash App 中需要有一个回调函数来执行某些操作然后刷新页面,只能使用 HTML A 标签实现页面重新加载。
html.A(html.Button('Refresh Data'),href='/')
必需的:
app.layout = html.Div([html.Button(id="refresh")])
@app.callback(Output('???', '???'),
[Input('refresh', 'n_clicks')])
def refresh(n):
## Perform some action ##
## call python function API ##
## Finally Refresh the Page ##
?
return ?
我想这是正确的方法:
将其添加到您的布局中:
dcc.Location(id='url', refresh=True),
打回来:
@app.callback(
Output("url", "href"),
Input("App-logo", "n_clicks"),
prevent_initial_call=True,
)
def reload_data(_):
return "/"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)