Coffeescript EmberJS pre 2用于为操作传入JS事件对象

Coffeescript EmberJS pre 2用于为操作传入JS事件对象,coffeescript,ember.js,Coffeescript,Ember.js,我知道我可以通过上下文。但我想知道是否有办法获取实际事件。如果需要事件对象,则需要创建自定义的视图。以下是我在应用程序中使用的示例: # in the handlebars template {{action "do_something" target="view"}} # in the view APP.view = Ember.View.extend( do_something: (evt) -> console.log evt #this used to con

我知道我可以通过上下文。但我想知道是否有办法获取实际事件。

如果需要事件对象,则需要创建自定义的
视图。以下是我在应用程序中使用的示例:

# in the handlebars template    
{{action "do_something" target="view"}}

# in the view
APP.view = Ember.View.extend(
  do_something: (evt) ->
    console.log evt #this used to contain a javascript event object, it was useful at times :(
)
在模板中:

App.ProductsGridSortButtonView = Ember.View.extend({
  tagName: 'a',
  classNames: ['productsSortButton'],
  attributeBindings: ['data-sort','data-sort-type'],
  click: function(e){
    this.get('parentView').sortProducts(e);
  }
});

我想那会有用的……但老实说,这是一个糟糕的解决方案。我开始质疑余烬在pre4中的方向。设置路由器的新方法很好,但是其他很多东西都被破坏了。我明白你的意思。。从pre1到最新版本可能需要时间。。。虽然这是一个核心概念,将有助于编写更好的代码,
视图
是处理用户交互/事件的地方,我认为指南正在对此进行更新
{{#view App.ProductsGridSortButtonView data-sort="price" data-sort-type="number"}}