-
Notifications
You must be signed in to change notification settings - Fork 0
/
tree.html
202 lines (164 loc) · 6.82 KB
/
tree.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
191
192
193
194
195
196
197
198
199
200
201
202
<!DOCTYPE html>
<html lang="en">
<head>
<script src="vendors~index~test.js"></script>
<script src="vendors~index.js"></script>
<script src="index.js"></script>
<script src="test.js"></script>
<!-- Load components via WebComponents.waitFor -->
<script type="module">
</script>
<!-- Change stuff here for your app -->
<meta name="description" content="start-lit-element">
<meta name="theme-color" content="#ffffff">
<title>start-lit-element</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta charset="UTF-8">
<style>
</style>
</head>
<body>
<div style='margin:10px auto;'>
<div style='width:40%;float:left;'>
<p-tree includestartnode>
<p-tree-node id="tree-node" name="test" toogle='false' icon="search" >
<p-tree-node name="test_01" icon="search" >
<p-tree-node name="test_01" icon="lock" >
</p-tree-node>
</p-tree-node>
<p-tree-node name="test _02" icon="search">
<p-tree-node name="test_02_01" icon="lock" >
<span slot="node_name" icon="lock">我爱郑敏</span>
</p-tree-node>
<p-tree-node name="test_02_02" icon="search" >
</p-tree-node>
<p-tree-node name="test_01" icon="search" >
</p-tree-node>
<p-tree-node name="test_01" icon="search"></p-tree-node>
</p-tree-node>
</p-tree-node>
</p-tree>
</div>
<div style='width:55%;float:right;'>
<p-input type='text' debounce=500 oninput="console.log(new Date()); window.tree.filterString=this.value"></p-input>
<p-tree id="p-tree" class='tree' includestartnode style='max-height: 500px;overflow: auto;'>
</p-tree>
</div>
<div style='clear:both'></div>
</div>
<p-scroll style='height:400px;width:80%;margin:10px auto;border:1px solid #b1b1b1' id="scrollID">
<p-menu >
<p-menuitem icon='save' label=保存></p-menuitem>
<p-menuitem icon='delete' label=删除></p-menuitem>
<p-menuitem icon='file-excel' label=导出到Word&Excel></p-menuitem>
<div style='border-bottom:1px solid #d1d1d1;margin-top:5px;margin-bottom:5px'></div>
<p-menuitem label=打回></p-menuitem>
<p-menuitem label=同意></p-menuitem>
<p-menuitem icon='rollback' label=退回></p-menuitem>
<p-menuitem icon='delete' label=删除></p-menuitem>
<p-menuitem icon='file-excel' label=导出></p-menuitem>
</p-menu>
</p-scroll>
<script>
const scroll=document.getElementById('scrollID');
scroll.addEventListener('scroll-x', function(event){
console.log(`scroll-x ${ event.detail.oldValue } to ${event.detail.value}`);
});
scroll.addEventListener('scroll-y', function(event){
console.log(`scroll-y ${ event.detail.oldValue } to ${event.detail.value}`);
});
scroll.addEventListener('scroll-x-end', function(event){
console.log('scroll-x-end' );
});
scroll.addEventListener('scroll-y-end', function(event){
console.log('scroll-y-end' );
});
scroll.addEventListener('scroll-change', function(event){
console.log(`scroll-change scrollTop=${event.detail.scrollTop } scrollLeft= ${event.detail.scrollLeft}` );
});
const frag=document.createDocumentFragment();
for(let i=0,j=40;i<j;i++){
var div =document.createElement('div');
div.innerHTML=`<div style='width:${300+Math.random()*500}px;border:1px solid #b2b2b2;margin:20px;'>${i}王刚王刚王刚王刚王刚王刚王刚王刚王刚王刚王刚王刚王刚</div>`;
frag.appendChild(div);
}
var div=document.createElement('div');
div.innerHTML=`
<br/>
`;
frag.appendChild(div);
scroll.appendChild(frag);
</script>
<p-pop id='popObj' style='margin-top:100px;margin-left:300px;' type='confirm' tipTitle='tips'
tipContent='bundles index.ts → build\index.js, docs\build\index.js...
created build\index.js, docs\build\index.js in 1.4s' >
<div style='width:200px;height:200px;border:1px solid #b2b2b2;'> <p-tips dir='topleft' tips='wanggang'><p-icon name='search' ></p-icon></p-tips></div>
<p-pop-content tip-title='注意' tip-title-icon='home' type='confirm'>
<p>bundles index.ts → build\index.js,</p>
<p>bundles index.ts → build\index.js,</p>
<p>bundles index.ts → build\index.js,</p>
<p>bundles index.ts → build\index.js,</p>
<p>bundles index.ts → build\index.js,</p>
<p>bundles index.ts → build\index.js,</p>
<p>bundles index.ts → build\index.js,</p>
<p>bundles index.ts → build\index.js,</p>
<p>docs\build\index.js...
created build\index.js,</p>
</p-pop-content>
</p-pop>
<style>
p-menu{
display:block;
width:350px;
margin:20px;
}
p-img{
width: 200px;
height: 150px;
margin: 0 10px 10px 0
}
#popObj p-pop-content::part(popBody){
color:red;
width:auto;
}
p-pop-content::part(popTitle){
color:red;
}
</style>
<p-pop id='popObj2' style='margin-top:100px;margin-left:300px;' tipTitle='tips' >
<p-tips dir='topleft' tips='wanggang'><p-icon name='search' ></p-icon></p-tips>
<p-pop-content tipTitle='注意' type='confirm'>
<p>bundles index.ts → build\index.js,</p>
<p>docs\build\index.js...
created build\index.js,</p>
</p-pop-content>
</p-pop>
<p-img lazy src='http://image.xsc'></p-img>
<p-img lazy src="https://images.xxx.jpg" defaultsrc="https://images.pexels.com/photos/374918/pexels-photo-374918.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940"></p-img>
<p-img lazy show-alt src="https://images.pexels.com/photos/841228/pexels-photo-841228.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940" alt="image-keyboard"></p-img>
<p-img lazy src="https://images.pexels.com/photos/841228/pexels-photo-841228.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940"></p-img>
<p-img lazy src="https://images.xxx.jpg" alt="image-keyboard" error-alt='加载错误拉。。。'></p-img>
<script >
const pop=document.getElementById('popObj');
</script>
<script>
fetch("./test.json").then(function(response) {
return response.json();
})
.then(function(myJson) {
const tree=document.getElementById('p-tree');
console.log(myJson);
const arry={"name":'地图',child:[]};
arry.child=[];
for(let i=0;i<100;i++ ){
for(let x=0,y=myJson.length;x<y;x++){
arry.child.push(JSON.parse(JSON.stringify(myJson[x])));
}
}
tree.data=arry;
window.tree=tree;
});
</script>
</body>
</html>