dag*_*da1 5 backbone.js underscore.js
我正在使用来自backbone.js的underscore.js的模板功能,我有以下模板,我在我的页面中定义如下:
<script type="text/template" id="businessunit_template">
<tr data-uid="{{Uid}}">
<td class="first"><span>{{Name}}</span></td>
<td class="{{StatusClass}} tac">{{OverallScore}}%</td>
<td>
<a class="impactanalysis individualBu" href="#"> </a>
</td>
</tr>
</script>
Run Code Online (Sandbox Code Playgroud)
我将trs附加到下表的tbody元素:
<table class="listing">
<thead>
<tr>
<th class="first">Business Units</th>
<th>BCMS<br />Status</th>
<th>View</th>
</tr>
</thead>
<tbody id="reportBusinessUnits"></tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
我呈现tr的个人骨干视图如下所示:
class ReportBusinessUnitView extends MIBaseView
initialize: (options) ->
@vent = options.vent
@template = _.template($('#businessunit_template').html())
events:
"click .individualBu": "showBusinessUnitDetail"
showBusinessUnitDetail: (e) =>
e.preventDefault()
self = @
@vent.trigger('management:showbusinessunitdeail', @model)
render: =>
$(@el).html(@template(@model.toJSON()))
@
Run Code Online (Sandbox Code Playgroud)
问题是,渲染的输出在tr周围有一个div,我不知道它来自哪里:
<div>
<tr data-uid="a5e3c218-1ca4-4806-b27e-24a25ed83ab6">
<td class="first"><span>Central Networks</span></td>
<td class="red tac">4%</td>
<td>
<a class="impactanalysis individualBu" href="#"> </a>
</td>
</tr>
</div>
Run Code Online (Sandbox Code Playgroud)
我只是看不出我做错了什么.有谁知道这可能来自哪里?
归档时间: |
|
查看次数: |
5100 次 |
最近记录: |