我最近启动了一个 Dash 应用程序,它显示我通过 HTML.iFrame 显示的预先注册的 HTML 文件:
html.Iframe(id = 'my-output', src = "assets/ABCD.html",
style={"height": "495px", "width": "100%",})
Run Code Online (Sandbox Code Playgroud)
我有一个函数/应用程序回调,如下所示:
@app.callback(
Output(component_id='my-output', component_property='children'),
Input(component_id='my-input', component_property='value'),
)
def update_output_div(input_value):
return XYZ
Run Code Online (Sandbox Code Playgroud)
现在我需要在 src 中输出该输出值,如下所示
html.Iframe(id = 'my-output', src = "assets/XYZ.html",
style={"height": "495px", "width": "100%",})
Run Code Online (Sandbox Code Playgroud)
但我不知道如何取回该输出值并更改我的 src 参数。
我尝试将本地 html 文件嵌入到基本的 Dash 应用程序中。我使用了此链接中的代码,并将路径替换为我的本地相对路径(破折号应用程序与 html 本地页面位于同一文件夹中)
html.Iframe(src="random_example.html",
style={"height": "1067px", "width": "100%"})
Run Code Online (Sandbox Code Playgroud)