ภาษาจีนง่ายๆ | ภาษาอังกฤษ
มีชุดของฟังก์ชั่นเครื่องมือ/คลาสเครื่องมือสำหรับการปรับปรุงประสิทธิภาพของการพัฒนาแอปพลิเคชัน Dash
ติดตั้งและมีส่วนร่วมในแผนพัฒนาผลงานด้วยปลั๊กอิน VSCODE
pip install feffery-dash-utils -U ใน vscode ด้วยปลั๊กอิน feffery-dash-snippets คุณสามารถใช้การนำเข้าอย่างรวดเร็วของฟังก์ชั่นเครื่องมือ/คลาสเครื่องมืออย่างรวดเร็ว ป้อน utils: ในไฟล์ Python เพื่อทริกเกอร์คำสั่งทางลัดที่เกี่ยวข้อง
style() พจนานุกรมพารามิเตอร์ style ที่ใช้ในการสร้างส่วนประกอบ Dash ได้อย่างรวดเร็วมีแอตทริบิวต์ css ทั่วไปในรูปแบบการตั้งชื่ออูฐขนาดเล็กส่วนใหญ่ วางเมาส์เหนือชื่อพารามิเตอร์ในแนวคิดทั่วไปเพื่อดูการแนะนำฟังก์ชั่นแอตทริบิวต์ภาษาจีนและภาษาอังกฤษที่สอดคล้องกัน เนื้อหาจะถูกสร้างขึ้นโดยอัตโนมัติตาม w3cschool
ตัวอย่างการใช้งาน
from feffery_dash_utils . style_utils import style
# 方式一:直接编写键值对样式
fac . AntdText (
'测试' ,
style = style (
fontSize = 16 ,
color = 'red'
)
)
# 方式二:解析CSS代码片段
fac . AntdText (
'测试' ,
style = style (
"""
.IvkwhTOsc9wu6RdvHESR .yK52Sq0w7wspWaS28YNl {
width: 91.46%;
margin-left: 4.27%;
margin-bottom: 5%;
position: relative;
}"""
)
)
# 方式三:混合使用
fac . AntdText (
'测试' ,
style = style (
"""
.IvkwhTOsc9wu6RdvHESR .yK52Sq0w7wspWaS28YNl {
width: 91.46%;
margin-left: 4.27%;
margin-bottom: 5%;
position: relative;
}""" ,
fontSize = 16 ,
color = 'red'
)
)TreeManager มันถูกใช้เพื่อดำเนินการจัดการอย่างรวดเร็วบนข้อมูลโครงสร้างต้นไม้ที่ส่วนประกอบของต้นไม้เช่น AntdTree และ AntdTreeSelect ขึ้นอยู่กับ วิธีการเฉพาะรวมถึง:
update_tree_node() ใช้เพื่อทำการอัปเดตโดยรวมหรือเพิ่มขึ้นไปยังโหนดที่สอดคล้องกับ key ที่ระบุในข้อมูลโครงสร้างต้นไม้
ตัวอย่างการใช้งาน
from feffery_dash_utils . tree_utils import TreeManager
# 示例树形数据
demo_tree = [
{
'title' : '节点1' ,
'key' : '节点1' ,
'children' : [
{
'title' : '节点1-1' ,
'key' : '节点1-1' ,
'children' : [
{
'title' : '节点1-1-1' ,
'key' : '节点1-1-1' ,
},
{
'title' : '节点1-1-2' ,
'key' : '节点1-1-2' ,
},
],
}
],
},
{ 'title' : '节点2' , 'key' : '节点2' },
]
# 对示例树形数据指定节点进行整体替换
TreeManager . update_tree_node (
demo_tree ,
'节点1-1' ,
{ 'title' : '节点1-1' , 'key' : '节点1-1' },
)
# 对示例树形数据指定节点进行增量更新
TreeManager . update_tree_node (
demo_tree ,
'节点1-1' ,
{ 'title' : '节点1-1new' },
'overlay' ,
)add_node_before() ใส่โหนดแนวนอนใหม่ก่อนที่จะระบุ key ที่สอดคล้องกันในข้อมูลโครงสร้างต้นไม้
ตัวอย่างการใช้งาน
from feffery_dash_utils . tree_utils import TreeManager
# 示例树形数据
demo_tree = [
{
'title' : '节点1' ,
'key' : '节点1' ,
'children' : [
{
'title' : '节点1-1' ,
'key' : '节点1-1' ,
'children' : [
{
'title' : '节点1-1-1' ,
'key' : '节点1-1-1' ,
},
{
'title' : '节点1-1-2' ,
'key' : '节点1-1-2' ,
},
],
}
],
},
{ 'title' : '节点2' , 'key' : '节点2' },
]
# 在示例树形数据指定节点前插入平级新节点
TreeManager . add_node_before (
demo_tree ,
'节点1-1' ,
{ 'title' : '节点1-0' , 'key' : '节点1-0' },
)add_node_after() ใส่โหนดแนวนอนใหม่หลังจากระบุโหนดที่สอดคล้องกันของ key ในข้อมูลโครงสร้างต้นไม้
ตัวอย่างการใช้งาน
from feffery_dash_utils . tree_utils import TreeManager
# 示例树形数据
demo_tree = [
{
'title' : '节点1' ,
'key' : '节点1' ,
'children' : [
{
'title' : '节点1-1' ,
'key' : '节点1-1' ,
'children' : [
{
'title' : '节点1-1-1' ,
'key' : '节点1-1-1' ,
},
{
'title' : '节点1-1-2' ,
'key' : '节点1-1-2' ,
},
],
}
],
},
{ 'title' : '节点2' , 'key' : '节点2' },
]
# 在示例树形数据指定节点后插入平级新节点
TreeManager . add_node_after (
demo_tree ,
'节点1-1' ,
{ 'title' : '节点1-2' , 'key' : '节点1-2' },
)delete_node() ลบโหนดที่สอดคล้องกับ key ที่ระบุในข้อมูลโครงสร้างต้นไม้
ตัวอย่างการใช้งาน
from feffery_dash_utils . tree_utils import TreeManager
# 示例树形数据
demo_tree = [
{
'title' : '节点1' ,
'key' : '节点1' ,
'children' : [
{
'title' : '节点1-1' ,
'key' : '节点1-1' ,
'children' : [
{
'title' : '节点1-1-1' ,
'key' : '节点1-1-1' ,
},
{
'title' : '节点1-1-2' ,
'key' : '节点1-1-2' ,
},
],
}
],
},
{ 'title' : '节点2' , 'key' : '节点2' },
]
# 删除示例树形数据指定节点
TreeManager . delete_node ( demo_tree , '节点2' )get_node() สอบถามโหนดที่สอดคล้องกับ key ที่ระบุในข้อมูลโครงสร้างต้นไม้
ตัวอย่างการใช้งาน
from feffery_dash_utils . tree_utils import TreeManager
# 示例树形数据
demo_tree = [
{
'title' : '节点1' ,
'key' : '节点1' ,
'children' : [
{
'title' : '节点1-1' ,
'key' : '节点1-1' ,
'children' : [
{
'title' : '节点1-1-1' ,
'key' : '节点1-1-1' ,
},
{
'title' : '节点1-1-2' ,
'key' : '节点1-1-2' ,
},
],
}
],
},
{ 'title' : '节点2' , 'key' : '节点2' },
]
# 查询示例树形数据中存在的指定节点
TreeManager . get_node ( demo_tree , '节点1-1' )
# 查询示例树形数据中不存在的指定节点(将返回None)
TreeManager . get_node ( demo_tree , '节点1-666' )Translator มันถูกใช้เพื่อสร้างโซลูชั่นหลายภาษาต่างประเทศอย่างรวดเร็วในแอปพลิเคชัน Dash โดยใช้ cookies ส่วนหน้าและไดรเวอร์ไฟล์การกำหนดค่าระหว่างประเทศในท้องถิ่น
ตัวอย่างการใช้งาน
ดู i18n_test_app.py, i18n_multi_test_app.py ตัวอย่างแอปพลิเคชัน ดู loclees.json, locales1.json, locales2.json สำหรับไฟล์การกำหนดค่าอ้างอิง
git clone https://github.com/CNFeffery/feffery-dash-utils.git
cd feffery-dash-utils
# 安装开发环境所需依赖
pip install -r requirements/dev.txtstyle_utils style ฟังก์ชั่นผู้ช่วย style() layout_utils router_utils ชั่นเครื่องมือที่เกี่ยวข้อง template_utils table_utils callback_utils tree_utils TreeManager update_tree_node() add_node_before() add_node_after() หลังจากใส่โหนดต้นไม้ delete_node() get_node() theme_utils i18n_utils Translator เนื้อหาการเขียนคำโฆษณา