-
Notifications
You must be signed in to change notification settings - Fork 3
/
tree测试222.html
190 lines (182 loc) · 5.96 KB
/
tree测试222.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>tree测试222</title>
<link rel="stylesheet" href="https://cdn.bootcss.com/twitter-bootstrap/4.1.2/css/bootstrap.min.css" />
<script src="https://cdn.bootcss.com/jquery/3.3.0/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/twitter-bootstrap/4.1.2/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="../dist/themes/default/style.min.css" />
<script src="../dist/jstree.min.js"></script>
<script>
$(function () {
$('#jstree_demo_div').jstree();
});
// $('#jstree_demo_div').on("changed.jstree", function (e, data) {
// console.log(data.selected);
// });
// $('button').on('click', function () {
// $('#jstree').jstree(true).select_node('child_node_1');
// $('#jstree').jstree('select_node', 'child_node_1');
// $.jstree.reference('#jstree').select_node('child_node_1');
// });
$(function () {
$('#html1').jstree()
});
$(function () {
$('#jstree').jstree({
"core": {
"animation": 0,
"themes": {
"dots": true,
"icons": true,
"stripes": false
},
"check_callback": true,
"multiple": false,
'data': data
},
"types": {
"#": {
"max_children": 5,
"max_depth": 11,
},
"default": {
"icon": "false",
"valid_children": ["default", "text"]
},
"text": {
"valid_children": []
}
},
"plugins": ["state", "types", "wholerow"]
});
});
</script>
<script>
function myFunction() {
x = document.getElementById("文件夹1"); // 找到元素
x.style.color = "red"; // 改变内容
x.style.fontSize = "larger";
}
</script>
</head>
<!-- 传递给网页一个数组,数组中是文件夹和文件,用json格式存放 -->
<body>
<div id="container2"><h3>container2</h3></div>
<script>
$(function() {
$("#container2").load("user.html");//获取txt文件内容放在DIV里面
$('#container2').jstree({
'core' : {
'data' : [
{ "text" : "Root node", "children" : [
{ "text" : "Child node 1" },
{ "text" : "Child node 2" }
]
},
{ "text" : "Root node", "children" : [
{ "text" : "Child node 1" },
{ "text" : "Child node 2" }
]
}
]
}
});
});
</script>
<div class="container">
<div class="row clearfix">
<div class="col-md-12 column">
<h3 class="text-center">
这里放当前项目的名字
</h3>
</div>
</div>
<div class="row clearfix">
<div class="col-md-2 column">
<div class="list-group">
<div class="list-group-item active">项目列表</div>
<div id="jstree">
<!-- in this example the tree is populated from inline HTML -->
<ul>
<li>第一个文件夹
<ul>
<li id="child_node_1">第一个脚本</li>
<li data-jstree='{"icon":"https://www.jstree.com/tree.png"}'>第二个脚本</li>
<!-- <li data-jstree ='{“icon”:“path / file.png”}'> </li> -->
<!-- <li data-jstree='{"icon":"fa fa-check"}'> -->
<!-- var nodeId = $(#tree).jstree(true).get_node("node_name"); -->
<!-- $("#tree").jstree(true).set_icon(nodeId, "/images/blabla.png"); -->
</ul>
</li>
<li>第二个文件夹</li>
</ul>
</div>
<div id="html1">
<ul>
<li class="jstree-open" id="node_1">使用class展开的文件夹
<ul>
<li>
<a href="#" class="jstree-clicked">第三个脚本</a>
</li>
</ul>
</li>
</ul>
<ul>
<li data-jstree='{"opened":true,"selected":true}'>使用data-jstree展开的文件夹
<ul>
<li data-jstree='{"disabled":true}'>第四个脚本</li>
<li data-jstree='{"icon":"https://jstree.com/tree.png"}'>
第五个脚本</li>
<li data-jstree='{"icon":"glyphicon glyphicon-leaf"}'>
第六个脚本</li>
</ul>
</li>
</ul>
<ul>
<li id="文件夹1" onclick="myFunction()" data-jstree='{"opened":true,"selected":true}'>
默认选中的文件夹
<ul>
<li data-jstree='{"icon":"glyphicon glyphicon-leaf"}'>1</li>
<li data-jstree='{"icon":"fa fa-check"}'>2</li>
<li>3</li>
</ul>
</li>
<li>
文件夹2
</li>
<li>
文件夹3
</li>
<li>
文件夹4
</li>
<li>
文件夹5
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-9 column">
<h3>
这里放选中的脚本的名字
</h3>
<p>
这里放选中的脚本的具体代码
</p>
</div>
<div class="col-md-1 column">
<div class="btn-group btn-group-vertical btn-group-lg">
<button type="button" class="btn btn-default btn-danger">编辑</button>
<button type="button" class="btn btn-default btn-info">保存</button>
<button type="button" class="btn btn-default btn-success">运行当前项目的入口文件index.js</button>
</div>
</div>
</div>
</div>
</body>
</html>