Tôi muốn biết làm thế nào để kích hoạt một hành động khi một đầu vào được tập trung ..
ngay bây giờ tôi đang sử dụng này trên mẫu của tôi: {{view "clickinput" class="form-control" placeholder="search..." value=s action="focus"}}
và điều này là quan điểm:Làm cách nào để kích hoạt hành động khi đầu vào được lấy tiêu điểm?
export default Ember.TextField.extend({
onEvent: 'focusIn',
focusIn: function() {
this.sendAction('focusIn', this, event);
}
});
và điều này trên điều khiển của tôi:
actions: {
focus: function() {
alert('f');
}
}
nhưng nó không hoạt động ..
tôi nhận được lỗi này trên chrome: Uncaught Error: Assertion Failed: The focusIn action was triggered on the component <[email protected]:clickinput::ember438>, but the action name (function superWrapper() { var ret, sup = this.__nextSuper; this.__nextSuper = superFunc; ret = func.apply(this, arguments); this.__nextSuper = sup; return ret; }) was not a string.
tại sao?