Skip to content

Commit 1dc36c1

Browse files
committed
all
1 parent d06fbd6 commit 1dc36c1

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/App.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ export default {
1717
id:1,
1818
name:"音乐",
1919
children:[]
20+
},{
21+
id:220,
22+
name:"游戏",
23+
children:[],
24+
path:"http://www.baidu.com"
2025
},{
2126
id:2,
2227
name:"视频",

src/component/vue-ztree.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,13 @@ export default{
241241
242242
// 根判断
243243
if(this.root=='0'){
244+
244245
strRootClass = (this.num==0 && !this.model.children) ? "roots_docu" : (this.nodes==1) || (this.num==0 && this.nodes!=this.num+1) ?
245-
"root_" : (this.nodes == this.num+1) ? "bottom_" : "center_"
246+
"root_" : (this.nodes == this.num+1) ? "bottom_" : "center_";
246247
247248
// 子树判断
248249
}else if(this.root=='1') {
250+
249251
strRootClass = this.nodes>1 && this.model.children && this.nodes!=this.num+1
250252
? "center_" :
251253
(this.num == 0 && this.nodes>1) || (this.nodes!=this.num+1) ? "center_docu" :
@@ -260,16 +262,20 @@ export default{
260262
},
261263
// 展开/收起
262264
prefixClass:function(){
263-
console.log(this.rootClass);
264-
265265
var returnChar = "";
266+
266267
if(this.rootClass.indexOf("docu")==-1){
267268
if(this.model.isFolder){
268-
returnChar = "open";
269+
returnChar = "open";
269270
}else {
270-
returnChar = 'close'
271-
}
271+
returnChar = 'close';
272+
}
272273
}
274+
275+
if(!this.model.children && this.rootClass.indexOf("docu")==-1){
276+
returnChar = 'docu';
277+
}
278+
273279
return returnChar;
274280
}
275281
},

0 commit comments

Comments
 (0)