ul in li , tree display with jade

瘦欲@ 提交于 2019-12-12 23:53:10

问题


I have a object of object of object ... i have a tree !

i use this jade code for display my tree :

mixin file_list(files)
ul
    each file, i in files
        li #{file.id}
        if file.children.length > 0
            mixin file_list(file.children)

but the result is:

<ul>
    <li></li>
    <ul>
        <li></li>
    </ul>
</ul>

i need :

<ul>
    <li>
        <ul>
            <li></li>
        </ul>
    </li>
</ul>

回答1:


mixin file_list(files)
ul
    each file, i in files
        li #{file.id}
            if file.children.length > 0
                mixin file_list(file.children)


来源:https://stackoverflow.com/questions/18483956/ul-in-li-tree-display-with-jade

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!