当前位置:网站首页>【若依(ruoyi)】ztree 自定义图标(iconSkin 属性)
【若依(ruoyi)】ztree 自定义图标(iconSkin 属性)
2022-07-06 02:41:00 【sayyy】
前言
- ruoyi 4.6.0
- JQuery zTree core 3.5.12
创建 iconSkin
.ztree li span.button.ico2_ico_open{
margin-right:2px; background-position: -147px -21px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.ico2_ico_close{
margin-right:2px; margin-right:2px; background-position: -147px 0; vertical-align:top; *vertical-align:middle}
.ztree li span.button.ico2_ico_docu{
margin-right:2px; background-position: -147px 0; vertical-align:top; *vertical-align:middle}
.ztree li span.button.ico2_ico_open
:支节点展开状态的样式.ztree li span.button.ico2_ico_close
:支节点折叠状态的样式.ztree li span.button.ico2_ico_docu
:叶子节点的样式.ztree li span.button.<iconSkin 名称>_ico_open
:<iconSkin 名称>
可自定义iconSkin ico2
:.ztree li span.button.ico2_ico_docu
的图标设置成与.ztree li span.button.ico2_ico_close
的图标一致
使用iconSkin方式1:
var setting = ...;
//js中节点数据:
var zTreeNodes = [
//父节点展开 折叠时使用相同的图标
{
name:"父节点1", iconSkin:"diy01"},
//父节点展开 折叠时分别使用不同的图标
{
name:"父节点2", iconSkin:"diy02"},
//叶子节点个性化图标
{
name:"叶子节点", iconSkin:"diy03"}
];
//zTree 初始化
$.fn.zTree.init($("#tree"), setting, zTreeNodes);
使用iconSkin方式2:
var treeObj = $.fn.zTree.getZTreeObj("tree");
var treeNodes = treeObj.transformToArray(treeObj.getNodes());
treeNodes.forEach(treeNode => {
if (!treeNode.isParent) {
/* 将叶子节点的iconSkin设置为:ico2 */
treeNode.iconSkin = "ico2";
treeObj.updateNode(treeNode);
}
});
参考
https://treejs.cn/v3/api.php
边栏推荐
- "Hands on learning in depth" Chapter 2 - preparatory knowledge_ 2.3 linear algebra_ Learning thinking and exercise answers
- 淘宝焦点图布局实战
- Zero foundation self-study STM32 - Review 2 - encapsulating GPIO registers with structures
- 3D drawing ()
- 纯Qt版中国象棋:实现双人对战、人机对战及网络对战
- SSM assembly
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 24
- 一位博士在华为的22年
- Trends in DDoS Attacks
- 2.11 simulation summary
猜你喜欢
Apt installation ZABBIX
剑指 Offer 30. 包含min函数的栈
Zero foundation self-study STM32 - Review 2 - encapsulating GPIO registers with structures
"Hands on learning in depth" Chapter 2 - preparatory knowledge_ 2.5 automatic differentiation_ Learning thinking and exercise answers
Network Security Learning - Web vulnerabilities (Part 1)
Advanced technology management - what is the physical, mental and mental strength of managers
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 7
故障分析 | MySQL 耗尽主机内存一例分析
MySQL winter vacation self-study 2022 11 (9)
The third level of C language punch in
随机推荐
数据准备工作
What should we pay attention to when using the built-in tool to check the health status in gbase 8C database?
Elimination games
事故指标统计
3D drawing ()
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8
米家、涂鸦、Hilink、智汀等生态哪家强?5大主流智能品牌分析
UE4 - how to make a simple TPS role (I) - create a basic role
继承的构造函数
解决:AttributeError: ‘str‘ object has no attribute ‘decode‘
Yyds dry inventory comparison of several database storage engines
DDoS attacks - are we really at war?
SSM assembly
LeetCode 103. Binary tree zigzag level order transverse - Binary Tree Series Question 5
高数_向量代数_单位向量_向量与坐标轴的夹角
更换gcc版本后,编译出现make[1]: cc: Command not found
Sword finger offer 30 Stack containing min function
Network Security Learning - Web vulnerabilities (Part 1)
High number_ Vector algebra_ Unit vector_ Angle between vector and coordinate axis
Advanced technology management - what is the physical, mental and mental strength of managers