无论如何,这个文本输入是否存在
<input type="text" aria-controls="existing-user-table" placeholder="Search">
Run Code Online (Sandbox Code Playgroud)
当用户点击进入时触发控制器上的动作?
我不喜欢将它包含在表单标签中或创建一个按钮,只是输入文本字段.
Mik*_*tti 29
使用{{input}}帮助程序 - 如果包含动作参数,它将在用户点击进入时在控制器上触发该动作.所以:
{{input action="myAction" aria-controls="existing-user-table" placeholder="Search"}}
Run Code Online (Sandbox Code Playgroud)
该输入助手API文档没有提到这个功能,但助手只是包装Ember.TextField
此外,可以通过指定onEvent属性来触发keyPress上的操作而不是enter :
{{input action="myAction" onEvent="keypress" aria-controls="existing-user-table" placeholder="Search"}}
Run Code Online (Sandbox Code Playgroud)
小智 29
输入助手具有一个insert-newline动作,当用户按下回车键时将触发该动作.
{{input type='text' aria-controls='existing-user-table' placeholder='Search' insert-newline='myAction'}}
Run Code Online (Sandbox Code Playgroud)
Vin*_*mar 16
从Ember v1.13.0开始,对输入助手的操作进行了描述,我们应该使用enter或key-press代替action
请参阅Ember Docs
{{input value=someValue enter='someAction'}}
Run Code Online (Sandbox Code Playgroud)
当用户按下输入文本输入时,这将触发上述操作
| 归档时间: |
|
| 查看次数: |
20495 次 |
| 最近记录: |