如何将 html 列表添加到破折号布局
how to add html lists to dash layout
我需要在屏幕上的特定位置动态添加单词列表以破折号布局(意味着单词列表随时间变化):
import dash
from dash.dependencies import Output, Input
import dash_core_components as dcc
import dash_html_components as html
import plotly
import plotly.graph_objs as go
app = dash.Dash(__name__)
trends =['python', 'flask', 'jave']
html_lists = []
trends =['python', 'flask', 'jave']
app.layout = html.Div(
html.Div(
className="trend",
children=[
html.Ui(
for i in trends:
html.Li(i))
], )
)
print(html_ul_list)
if __name__ == '__main__':
app.run_server(debug=True)
我需要在网页上的输出在屏幕右侧是这样的:
趋势
- python
java一个
等等...
您有几个小错误。我对此进行了测试并且有效:
app = dash.Dash(__name__)
trends = ['python', 'flask', 'java']
app.layout = html.Div(
html.Div(
className="trend",
children=[
html.Ul(id='my-list', children=[html.Li(i) for i in trends])
],
)
)
if __name__ == '__main__':
app.run_server(debug=True)
要使此列表动态更新,您需要连接一个输出如下的回调:Output('my-list', 'children')
。您可能已经知道该回调将接受哪些输入,但这不是您的一部分 post,所以我将其排除在外。
我需要在屏幕上的特定位置动态添加单词列表以破折号布局(意味着单词列表随时间变化):
import dash
from dash.dependencies import Output, Input
import dash_core_components as dcc
import dash_html_components as html
import plotly
import plotly.graph_objs as go
app = dash.Dash(__name__)
trends =['python', 'flask', 'jave']
html_lists = []
trends =['python', 'flask', 'jave']
app.layout = html.Div(
html.Div(
className="trend",
children=[
html.Ui(
for i in trends:
html.Li(i))
], )
)
print(html_ul_list)
if __name__ == '__main__':
app.run_server(debug=True)
我需要在网页上的输出在屏幕右侧是这样的:
趋势
- python
java一个
等等...
您有几个小错误。我对此进行了测试并且有效:
app = dash.Dash(__name__)
trends = ['python', 'flask', 'java']
app.layout = html.Div(
html.Div(
className="trend",
children=[
html.Ul(id='my-list', children=[html.Li(i) for i in trends])
],
)
)
if __name__ == '__main__':
app.run_server(debug=True)
要使此列表动态更新,您需要连接一个输出如下的回调:Output('my-list', 'children')
。您可能已经知道该回调将接受哪些输入,但这不是您的一部分 post,所以我将其排除在外。