Closed xuanq closed 1 month ago
复现代码: button = fac.AntdButton( "下载", id={"type": "button_download_file", "index": filepath}, icon=fac.AntdIcon(icon="antd-download"),
@callback( Output({"type": "download_file", "index": MATCH}, "data"), Input({"type": "button_download_file", "index": MATCH}, "n_clicks"), State({"type": "button_download_file", "index": MATCH}, "id"), ) def func(n_clicks, id): return dcc.send_file(id["index"])
点击按钮不会触发callback 换成html.Button或dbc.Button则可以正常触发
@xuanq 请注意,fac.AntdButton的点击事件对应的属性名叫nClicks,我们采用的是antd一致的小驼峰变量命名法
fac.AntdButton
nClicks
antd
复现代码: button = fac.AntdButton( "下载", id={"type": "button_download_file", "index": filepath}, icon=fac.AntdIcon(icon="antd-download"),
@callback( Output({"type": "download_file", "index": MATCH}, "data"), Input({"type": "button_download_file", "index": MATCH}, "n_clicks"), State({"type": "button_download_file", "index": MATCH}, "id"), ) def func(n_clicks, id): return dcc.send_file(id["index"])
点击按钮不会触发callback 换成html.Button或dbc.Button则可以正常触发