当前位置:网站首页>【若依(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
边栏推荐
- Atcoder beginer contest 233 (a~d) solution
- Solution: attributeerror: 'STR' object has no attribute 'decode‘
- Sword finger offer 30 Stack containing min function
- Bigder:34/100 面试感觉挺好的,没有收到录取
- 07 单件(Singleton)模式
- MySQL winter vacation self-study 2022 11 (5)
- "Hands on learning in depth" Chapter 2 - preparatory knowledge_ 2.3 linear algebra_ Learning thinking and exercise answers
- 微服务注册与发现
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 13
- Deeply analyze the chain 2+1 mode, and subvert the traditional thinking of selling goods?
猜你喜欢

C language - Blue Bridge Cup - promised score

剑指 Offer 29. 顺时针打印矩阵

2345 file shredding, powerful file deletion tool, unbound pure extract version

主数据管理理论与实践

微服务注册与发现

微软语音合成助手 v1.3 文本转语音工具,真实语音AI生成器

Li Kou today's question -729 My schedule I

Maturity of master data management (MDM)

Network Security Learning - Web vulnerabilities (Part 1)

Zero basic self-study STM32 wildfire review of GPIO use absolute address to operate GPIO
随机推荐
PMP practice once a day | don't get lost in the exam -7.5
The third level of C language punch in
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8
inherited constructors
深度解析链动2+1模式,颠覆传统卖货思维?
Shell脚本更新存储过程到数据库
剑指 Offer 30. 包含min函数的栈
淘宝焦点图布局实战
Network Security Learning - Web vulnerabilities (Part 1)
Thinking on Architecture Design (under continuous updating)
Template_ Find the reverse pair of permutations_ Sort based on merge
技术分享 | undo 太大了怎么办
Building the prototype of library functions -- refer to the manual of wildfire
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 17
Sword finger offer 29 Print matrix clockwise
MySQL winter vacation self-study 2022 11 (9)
Briefly describe the implementation principle of redis cluster
Data preparation
2.12 simulation
RobotFramework入门(二)appUI自动化之app启动