我尝试了DCC Loading component,也尝试了禁用默认的“加载.”的CSS方式组件处于加载状态时屏幕上的文本。它根本不起作用。请建议我用CSS在Plotly's Dash中将默认加载消息更改为加载程序的方法。
这是将作为登录页面加载的dashapp.py文件:
from dash import Dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
from config import appserver
import time
external_stylesheets = [dbc.themes.YETI,'./frontend/static/stylesheet.css']
dashapp = Dash(__name__, server = appserver,external_stylesheets=external_stylesheets,\
url_base_pathname='/application/', title='Home Page', assets_url_path='assets')
dashapp.css.config.serve_locally = True
dashapp.layout = html.Div([
html.H1('Hi Welcome to Dash-Flask integration app!'),
], id="child-process")
if __name__=='__main__':
dashapp.run_server(debug=True)CSS样式表出现在目录:./frontend/static/中。
我使用CSS样式表覆盖默认加载行为,如下所示:
*[data-dash-is-loading="true"]{
visibility: hidden;
}
*[data-dash-is-loading="true"]::before{
content: "Loading...";
display: inline-block;
color: magenta;
visibility: visible;
}发布于 2021-08-13 06:21:56
通过在/assets/style.css目录下添加下面的CSS文件,我的问题得到了解决。
/* assets/style.css */
._dash-loading {
margin: auto;
color: transparent;
width: 0;
height: 0;
text-align: center;
}
._dash-loading::after {
content: '';
display: inline-block;
width: 2rem;
height: 2rem;
color: black;
vertical-align: text-bottom;
border: 0.25em solid currentColor;
border-right-color: transparent;
border-radius: 50%;
-webkit-animation: spinner-border 0.75s linear infinite;
animation: spinner-border 0.75s linear infinite;
margin-top: 2rem;
}https://stackoverflow.com/questions/64124281
复制相似问题