// dom几点如下
<ul id="pid_0"> <li> <input type="text" name="classify" class="form-control one_line" value="一级目录" pid="0" level="1"> <span class="input_sign add first_add" pid="0" sign="add" level="0" ref="child" style="display: none;">[ + ]</span> <ul id="pid_1"> <li> <input class="form-control one_line" pid="0" level="2" name="classify"> <span class="input_sign add" pid="1" level="2" sign="add" ref="child" style="display: none;">[ + ]</span> <span class="input_sign reduce" pid="1" level="2" sign="reduce" ref="sibling">[ - ]</span> <ul id="pid_2"> <li> <input class="form-control one_line" pid="1" level="3" name="classify"> <span class="input_sign add" pid="2" level="3" sign="add" ref="child">[ + ]</span> <span class="input_sign reduce" pid="2" level="3" sign="reduce" ref="sibling">[ - ]</span> </li> <li> <span class="input_sign add" pid="1" level="2" sign="add" ref="sibling"> + </span> </li> </ul> </li> <li> <input class="form-control one_line" pid="0" name="classify" level="2"> <span class="input_sign add" sign="add" ref="child" pid="1" level="2">[ + ]</span> <span class="input_sign reduce" pid="0" level="1" sign="reduce" ref="child">[ - ]</span> </li> <li> <span class="input_sign add" pid="0" level="1" sign="add" ref="sibling"> + </span> </li> </ul> </li> <li id="lastChild_0"><span class="input_sign" pid="0" sign="add" ref="sibling" level="0"> + </span></li> </ul>
建一张表 一个ID 一个Name 一个parentId 然后添加父级 parentId 为0 添加下级 对应的parentId 为父级ID 就可以了
目前已经搞定了