From 3dda26e893fb945358e6ca00669c849d483ed897 Mon Sep 17 00:00:00 2001 From: zhaoxiang <756958008@qq.com> Date: Mon, 5 Jun 2017 19:40:40 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E4=BF=AE=E5=A4=8DJS=E4=B8=89?= =?UTF-8?q?=E7=BA=A7=E7=9B=AE=E5=BD=95=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Public/js/forTree.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Public/js/forTree.js b/Public/js/forTree.js index 9886a18..b8cf2cc 100644 --- a/Public/js/forTree.js +++ b/Public/js/forTree.js @@ -60,21 +60,20 @@ layui.define(function(exports) { /** * 开始循环 */ - this.each = function(arr) { + this.each = function(arr,index) { if(arr == undefined) { arr = _father; } - + var index = index ? index: 0; for(var i in arr) { var children = _that.getChildren(arr[i][_idName]); var counter = children.length; - _that.forBefore(arr[i], i, counter); _that.forCurr(arr[i], i, counter); - if(counter) { + if(counter && index==0) { _that.callBefore(arr[i], i); - _that.each(children); + _that.each(children,2); _that.callAfter(arr[i], i); } @@ -82,4 +81,4 @@ layui.define(function(exports) { } } }); -}); \ No newline at end of file +});