Backbone.js 多级ul
我正在开始一个骨干项目,我想我应该从菜单系统开始。 我的菜单基于多级 ul。所以基本上在一些 li 的侧面有嵌套的 ul,
我想知道如何为此创建一个模型/集合。就此而言,我将如何进行视图。我见过人们使用 li 标签类型创建视图。但我不确定这会如何运作。
I'm beginning a backbone project and I figured I'd start with the menu system.
My menu is based on a multi level ul. So basically there are nested uls in side some of the lis
I'm wondering how I would create a model/collection for that. And for that matter how I would do the view. I've seen people creating views with a tag type of li. But I'm not sure how that would work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我个人很喜欢使用集合视图和项目视图(防止重新渲染整个列表),
您
可以通过创建列表集合(集合的集合)来嵌套,
或者您可以只使用类名和样式 深度
http://jsfiddle.net/3HGuf/
像这样的
我认为这使代码更容易阅读
I am personally a fan of using the collection view and an item view (prevents rerendering the whole list)
gives you
which you could you could nest by creating a collection of lists (collections of collections)
or you can just style using a class name and depth
http://jsfiddle.net/3HGuf/
like that
I think it makes the code a little easier to read