gpt4 book ai didi

ember.js - 当输入获得焦点时如何触发 Action ?

转载 作者:行者123 更新时间:2023-12-04 10:04:09 25 4
gpt4 key购买 nike

我想知道如何在输入聚焦时触发 Action ..
现在我在我的模板上使用它:{{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);
}
});

这在我的 Controller 上:
actions: {
focus: function() {
alert('f');
}
}

但它不起作用..
我在 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.
为什么?

最佳答案

结果比我想象的要简单..
我只好写 {{input class="form-control" placeholder="search..." value=s focus-in="focus"}}在我的模板中

关于ember.js - 当输入获得焦点时如何触发 Action ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23116975/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com