我已经为文本框创建了组件,在这里我遇到了焦点输出触发器没有发生。如何从组件触发事件?
第 1 步创建文本框组件
文本框.hbs
{{input
type=type
value=amountValue
placeholder=placeholder
focus-out=focusouttrigger
}}
我在下面的代码中编写的脚本中的第 2 步
export default Component.extend({
amountValue: null,
didReceiveAttrs: function() {
this._super(...arguments);
let amountValue = this.get('amountValue');
this.setProperties({
amountValue: this.get('amountValue'),
type: this.get('type'),
placeholder: this.get('placeholder'),
focusOutInput: this.get('focusOutInput')
});
},
actions: {
focusouttrigger: function() {
console.log("working");
}
}
3)主页我在主页中添加了以下代码
<S2bText
@type='text'
@amountValue='1000'
@placeholder="Enter the Amount"
@focusOutInput = "focusouttrigger" />