Fixed #2336 - v2 PrimeVue @keyup.enter event does not work on InputNumber component

pull/2873/head
mertsincan 2022-08-22 16:02:44 +01:00
parent 6c97e0a8f0
commit 4e22038457
1 changed files with 4 additions and 1 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<span :class="containerClass" :style="styles"> <span :class="containerClass" :style="styles">
<INInputText ref="input" :class="['p-inputnumber-input', inputClass]" :style="inputStyle" :value="formattedValue" v-bind="$attrs" :aria-valumin="min" :aria-valuemax="max" <INInputText ref="input" :class="['p-inputnumber-input', inputClass]" :style="inputStyle" :value="formattedValue" v-bind="$attrs" :aria-valumin="min" :aria-valuemax="max"
@input="onUserInput" @keydown="onInputKeyDown" @keypress="onInputKeyPress" @paste="onPaste" @click="onInputClick" @focus="onInputFocus" @blur="onInputBlur"/> @input="onUserInput" @keydown="onInputKeyDown" @keyup="onInputKeyUp" @keypress="onInputKeyPress" @paste="onPaste" @click="onInputClick" @focus="onInputFocus" @blur="onInputBlur"/>
<span class="p-inputnumber-button-group" v-if="showButtons && buttonLayout === 'stacked'"> <span class="p-inputnumber-button-group" v-if="showButtons && buttonLayout === 'stacked'">
<INButton :class="upButtonClass" :icon="incrementButtonIcon" v-on="upButtonListeners" :disabled="$attrs.disabled" /> <INButton :class="upButtonClass" :icon="incrementButtonIcon" v-on="upButtonListeners" :disabled="$attrs.disabled" />
<INButton :class="downButtonClass" :icon="decrementButtonIcon" v-on="downButtonListeners" :disabled="$attrs.disabled" /> <INButton :class="downButtonClass" :icon="decrementButtonIcon" v-on="downButtonListeners" :disabled="$attrs.disabled" />
@ -525,6 +525,9 @@ export default {
break; break;
} }
}, },
onInputKeyUp(event) {
this.$emit('keyup', event);
},
onInputKeyPress(event) { onInputKeyPress(event) {
event.preventDefault(); event.preventDefault();
let code = event.which || event.keyCode; let code = event.which || event.keyCode;