Ember组件自定义动作

时间:2015-10-14 23:58:53

标签: ember.js ember-cli

我有一个自定义组件,我想将用户交互操作附加到:

pro-form-price-field{action 'saveCatalogTicket' ticket on='focus-out'} currency="usd" value=ticket.base_price class='inline-field inline-field-medium'

无法编译。关于如何将onFocusOut附加到自定义组件的任何想法?

1 个答案:

答案 0 :(得分:1)

只需将focusOut功能放在pro-form-price-field.js文件中。

import Ember from 'ember';
const { on } from Ember;

export default Ember.Component.extend({
  focusIn(){
  },
  // or as Thernys pointed out use on event.
  saveCatalogTicket: on('focusOut', function(){
  })
});