递归
// tree list
function tree_list(datalist) {
var html = '';
$.each(datalist, function (index, data) {
html += '<ul class="hr_ul1 change">';
html += '<li class="hr_left_1" cussortid="' + data["id"] + '"><span>' + data['name'] + ' <em class="list_num_null">(<i></i>)</em></span></li>';
if (data['children'] && data['children'].length > 0) {
html += tree_list(data['children'])
}
html += '</li>';
html += '</ul>'
});
return html
}
author:Lik
Endeavoring to powerless, struggling to move yourself.
Endeavoring to powerless, struggling to move yourself.