-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.py
More file actions
38 lines (31 loc) · 952 Bytes
/
app.py
File metadata and controls
38 lines (31 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import dash
from dash import html
import feffery_utils_components as fuc
from dash_vite_plugin import VitePlugin, NpmPackage
from dash.dependencies import Input, State, ClientsideFunction
vite_plugin = VitePlugin(
build_assets_paths=['assets'],
entry_js_paths=['assets/callback.js'],
npm_packages=[
NpmPackage('react'),
NpmPackage('react-dom'),
],
download_node=True,
clean_after=False, # 开发阶段建议设置为False以加速构建
)
vite_plugin.setup()
app = dash.Dash(__name__)
vite_plugin.use(app)
app.layout = html.Div(
[
fuc.FefferyTimeout(id='trigger-background-init', delay=100),
html.Div(id='background-mount'),
]
)
app.clientside_callback(
ClientsideFunction(namespace='clientside', function_name='renderBackground'),
Input('trigger-background-init', 'timeoutCount'),
State('background-mount', 'id'),
)
if __name__ == '__main__':
app.run(debug=True)