我刚刚开始使用破折号。以这里为例。我想转换下面的破折号应用程序
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div([
dcc.Input(id='my-id', value='initial value', type="text"),
html.Div(id='my-div')
])
@app.callback(
Output(component_id='my-div', component_property='children'),
[Input(component_id='my-id', component_property='value')]
)
def update_output_div(input_value):
return 'You\'ve entered "{}"'.format(input_value)
if __name__ == '__main__':
app.run_server()
Run Code Online (Sandbox Code Playgroud)
在用户按下按钮而不是在输入字段的值更改时更新。我该如何实现?
我正在尝试为不同的信息集创建一个具有多个选项卡的应用程序。我的第一个想法是使用 html 按钮,但没有 dash_core_component 用于此,而且我找不到任何可以在其位置使用的文档。基本上,当我点击一个按钮(或链接)时,我想获得一个带有按钮 id 的“clicked”事件,以便我可以重绘所选页面的布局。
有没有办法用现有的组件来做到这一点?是否有关于如何创建可以连接到回调系统的新组件的文档?我觉得我一定遗漏了一些明显的东西,但经过大量搜索后我没有找到任何东西。
谢谢!