在app.layout中,我有一个输入,当我在其中键入一些信息时,我想更改卡体的信息(html.H6)。 试着这样做我一直有这样的错误:
TypeError:ID为“CardBody(children={},ID='card_title1')”的dash_bootstrap_components.Card
组件(版本0.12.0)检测到除children
之外的其他道具的组件
您是否忘记在一个数组中包装多个children
?
属性id具有值CardBody(children={},id='card\u title1')
# This is inside app.layout:
html.Div([
dcc.Dropdown(
id='dropdown',
options=[{'label':i, 'value':i} for i in df['c'].unique()],
),
html.Div(id='output')
], className='search-bar'),
html.Div(
[
dbc.Row(
[
dbc.Col(children=[
dbc.Card(dbc.CardHeader("Diretor"),
dbc.CardBody([
html.H6({}, id='card_title1', className="card-title1"),
]), inverse=True)]),
],
className="mb-4 cardsrow",
),
]
),
### Callback function:
@app.callback(
Output('card-title1', 'children'),
Input('dropdown', 'value')
)
def update_output_div(stock_slctd):
if stock_slctd in df.CNPJ_FUNDO.unique():
dff = df[df['FUNDO_CODE']==stock_slctd]
else:
dff = df[df['FUND_NAME']==stock_slctd]
name = dff.DIR.iloc[0]
return name
与此相反:
您应该将多个子项包装在一个数组中,因为错误告诉您:
相关问题 更多 >
编程相关推荐