Vue 允许为 v-on 在监听键盘事件时添加按键修饰符:
`keyCode` 是 13 时调用 `customfunc()` --><input v-on:keyup.13="customfunc">记住所有的 keyCode 比较困难,所以 Vue 为最常用的按键提供了别名:
<!-- 同上 -->
<input v-on:keyup.enter="customfunc">
<!-- 缩写语法 -->
<input @keyup.enter="customfunc">
网友回复
Vue 允许为 v-on 在监听键盘事件时添加按键修饰符:
`keyCode` 是 13 时调用 `customfunc()` --><input v-on:keyup.13="customfunc">记住所有的 keyCode 比较困难,所以 Vue 为最常用的按键提供了别名:
<!-- 同上 -->
<input v-on:keyup.enter="customfunc">
<!-- 缩写语法 -->
<input @keyup.enter="customfunc">
网友回复