igu*_*der 7 handlebars.js ember.js
我想知道当输入聚焦时如何触发动作..
现在我在我的模板上使用它:{{view "clickinput" class="form-control" placeholder="search..." value=s action="focus"}}
这作为视图:
export default Ember.TextField.extend({
onEvent: 'focusIn',
focusIn: function() {
this.sendAction('focusIn', this, event);
}
});
Run Code Online (Sandbox Code Playgroud)
这在我的控制器上:
actions: {
focus: function() {
alert('f');
}
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用..
我在chrome上遇到此错误:Uncaught Error: Assertion Failed: The focusIn action was triggered on the component <appkit@view: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.
为什么?
igu*_*der 16
事实证明它比我想象的要简单.
我只需要{{input class="form-control" placeholder="search..." value=s focus-in="focus"}}在我的模板中 写
| 归档时间: |
|
| 查看次数: |
5202 次 |
| 最近记录: |