扩展主干视图时,是否可以不呈现标记名? [英] When extending a backbone view, is there a way to not render a tagname?

查看:75
本文介绍了扩展主干视图时,是否可以不呈现标记名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将JQueryUI手风琴脚本与我的主干视图一起使用. 在我的模板中,我有一个h3和div标签,一个是手风琴标题,另一个是内容. 由于扩展视图在每个模板化的项目周围放置了一个div,因此手风琴脚本添加的类不在正确的标签上.

I am trying to use the JQueryUI accordion script with my backbone view. In my template, i have an h3 and div tag, one for the accordion title, and one for content. Since the extended view puts a div around the each templated item, the classes that the accordion script adds are not on the correct tags.

推荐答案

我相信您可以像这样在页面上放置自己的占位符:

I believe you can just put your own placeholder on your page like this:

<div id="placeholder"/>

在主干视图代码中,请勿定义el.然后,在创建主视图时定义视图的el:

In your backbone view code, do NOT define el. Then define the view's el when you create the backbone view:

var search_view = new SearchView({ el: $("#placeholder") });

这篇关于扩展主干视图时,是否可以不呈现标记名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆