代码拉取完成,页面将自动刷新
同步操作将从 温山/layui-treetable 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<link rel="stylesheet" href="layui/css/layui.css">
</head>
<body style="width: 50%; padding: 10px 10px;">
<div id="demo"></div>
<div id="demo2"></div>
</body>
<script src="layui/layui.js"></script>
<script type="text/javascript">
function del(row) {
alert(row)
}
var layout = [
{ name: '菜单名称', treeNodes: true, headerClass: 'value_col', colClass: 'value_col', style: '' },
{
name: '操作',
headerClass: 'value_col',
colClass: 'value_col',
style: 'width: 20%',
render: function(row) {
return "<a class='layui-btn layui-btn-danger layui-btn-sm' onclick='del(" + row + ")'><i class='layui-icon'></i> 删除</a>"; //列渲染
}
},
];
layui.use(['form', 'treetable', 'layer'], function() {
var layer = layui.layer, form = layui.form, $ = layui.jquery;
var tree1 = layui.treetable({
elem: '#demo', //传入元素选择器
checkbox: true,
nodes: [{
"id": "1",
"name": "父节点1",
"children": [{
"id": "11",
"name": "子节点11"
},
{
"id": "12",
"name": "子节点12"
}
]
},
{
"id": "2",
"name": "父节点2",
"children": [{
"id": "21",
"name": "子节点21",
"children": [{
"id": "211",
"name": "子节点211"
}]
}]
}
],
layout: layout
});
var tree2 = layui.treeGird({
elem: '#demo2', //传入元素选择器
spreadable: true, //设置是否全展开,默认不展开
checkbox: false,
nodes: [{
"id": "d1",
"name": "父节点1",
"children": [{
"id": "d11",
"name": "子节点11",
"checked": true
}
]
},
{
"id": "d2",
"name": "父节点2",
"children": [{
"id": "d21",
"name": "子节点21",
"children": [{
"id": "d211",
"name": "子节点211"
}]
}]
}
],
layout: layout
});
form.render();
});
</script>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。