You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.6 KiB
47 lines
1.6 KiB
<!DOCTYPE html>
|
|
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>layui</title>
|
|
<meta name="renderer" content="webkit">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all">
|
|
<link rel="stylesheet" href="/static/css/public.css" media="all">
|
|
</head>
|
|
<body>
|
|
<div id="test2" class="demo-tree"></div>
|
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
|
|
<script>
|
|
var data;
|
|
layui.use(['form', 'layer','dropdown','tree'], function () {
|
|
var $ = layui.jquery,
|
|
tree = layui.tree,
|
|
test = tree.render({
|
|
elem: '#test2'
|
|
,data: []
|
|
,onlyIconControl: true //是否仅允许节点左侧图标控制展开收缩
|
|
,click: function(obj){
|
|
$("#openSonByDepository",window.parent.document).val(obj.data.title)
|
|
var index = parent.layer.getFrameIndex(window.name);
|
|
parent.layer.close(index);
|
|
|
|
}
|
|
});
|
|
$.ajax({
|
|
url: "/repository/treeMenus",
|
|
type: 'get',
|
|
dataType: 'json',
|
|
contentType: "application/json;charset=utf-8",
|
|
success: function (d) {
|
|
var data2 = d.data
|
|
console.log(data2)
|
|
test.reload({
|
|
data:data2
|
|
});
|
|
}
|
|
});
|
|
})
|
|
</script>
|
|
</body>
|
|
</html>
|