<!DOCTYPE html> <html> <head> <title>Tree</title> <link rel="stylesheet" type="text/css" href="layui/css/layui.css"> <style type="text/css"> body .layui-tree-skin-shihuang .layui-tree-branch{color: blue;} </style> </head> <body> <ul id="demo"></ul> </body> <script src="layui/layui.js"></script> <script type="text/javascript"> layui.use('tree', function(){ layui.tree({ elem:'#demo', skin:'shihuang', nodes: [{ //节点 name: '父节点1' ,children: [{ name: '子节点11' },{ name: '子节点12' }] },{ name: '父节点2(可以点左侧箭头,也可以双击标题)' ,children: [{ name: '子节点21' ,children: [{ name: '子节点211' }] }] }] }); }); </script> </html>
官网文档:
https://www.layui.com/doc/modules/tree.html