我正在使用主干和: https ://github.com/pragmaticly/smart-time-ago
当我加载页面时,没有显示任何时间前应该在的位置(但主干正在工作)。
这是我的主干观点:
class Voice.Views.PostsIndex extends Backbone.View
template: JST['posts/index']
initialize: ->
@collection.on('reset', @render, this)
render: ->
$(@el).html(@template(posts: @collection)).timeago
this
模板/帖子/index.jst.eco
<% for post in @posts.models: %>
<tbody id="postdata"><tr><td>
<center>
<% if post.get('content').length > 140: %>
<%=post.get('content').substring(0, 140)+"\t\t"%>
...<a href="show/<%= post.get('id') %>">see more</a>
<% else: %>
<%= post.get('content') %>
<% end %>
<br> </center>
<span class="green pull-left"><%= post.get('agrees') %> </span>
<span class="red pull-left"><%= post.get('disagrees') %> </span>
<span class="blue pull-left">0</span>
<span class="pull-right">
<time class="timeago" datetime="<%=post.get('created_at')%>">
</time>
</span>
</td></tr></tbody>
应用程序.js
//= require jquery
//= require jquery_ujs
//= require timeago
//= require underscore
//= require backbone
//= require voice
//= require bootstrap.min
//= require_tree ../templates
//= require_tree ./models
//= require_tree ./collections
//= require_tree ./views
//= require_tree ./routers
//= require_tree .
反正有没有让这个工作?提前致谢