如何实现折叠菜单的正负号的图标的变化
- 如题,
- 我的JS:
- function createTree(jsons, pid) {
? ? ? ? if (jsons != null) {
- var ul = '<ul class=" linghtTree">';
- for (var i = 0; i < jsons.length; i++) {
- if (jsons[i].pid == pid) {
- ul += '<li data-author=' + jsons[i].authorization + ' data-urlString=' + jsons[i].url + '><span class="iconSpan"><i class="icon-minus"></i> ' + jsons[i].name + "</span></li>";
- ul += createTree(jsons, jsons[i].id);
- }
- }
- ul += "</ul>";
- }
- return ul;
- }
- 我的测试json数据:
- { "id": "2", "name": "上海分公司", "url": "", "pid": "1", "authorization": "boss" }, { "id": "5", "name": "上海SSC-1", "url": "", "pid": "2", "authorization": "boss" }, { "id": "14", "name": "上海ABD", "url": "", "pid": "5", "authorization": "boss" }, { "id": "15", "name": "上海SABE", "url": "", "pid": "5", "authorization": "boss" }, { "id": "6", "name": "上海SSC-2", "url": "", "pid": "2", "authorization": "boss" }, { "id": "7", "name": "上海SSC-3", "url": "", "pid": "2", "authorization": "boss" },
1 个回复
lopo1983
赞同来自:
什么插件?
要是只是为了实现+-的话可以用tiggleclass 之类的来修改class 实现 图表可以用字体图标