javascript - 防止按钮上的输入键按下 - Vue
问题描述
我只想在点击事件上触发我的按钮(而不是按下回车键),它现在以动态方式工作:
<button class="btn btn-primary" type="button" v-on="{ click: isInProgress ? stop : start }">
我的问题是,如何将阻止修饰符以这种方式单击?我知道删除type="button"
也可以解决问题,但我不能。
那么@click.prevent=""
解决方案是v-on
什么?提前致谢!
解决方案
如果您想阻止“keydown.enter”触发按钮,您可以使用keydown.enter.prevent
<button
class=""
type="button"
v-on:keydown.enter.prevent
v-on="{ click: isInProgress ? stop : start }"
></button>
推荐阅读
- xpath - XPath 兄弟返回空
- linux - 在 Linux 上使用 Schwab StreetSmart Edge Cloud - Citrix 错误
- c++ - 无法将右值引用函数与 GCC 匹配
- linux - 如何从 key=value 格式的文件中仅获取选定的行?
- json - _CastError(“客户端”类型不是“列表”类型的子类型
' 在类型转换中) - c# - 是否可以使用 Roslyn 构建 ASP.Net Core Web 应用程序?
- python - 范围类的计数方法的目的是什么?
- excel - 在excel中转置日期以包含标题行
- sql - 'local-name()' 需要一个单例(或空序列)T-SQL Xquery
- powershell - 基于 ComboBox1 填充 ComboBox2 时遇到问题