Add form support to `InputOtp`
parent
79f51434d7
commit
044a900f9d
|
@ -1,31 +1,15 @@
|
||||||
<script>
|
<script>
|
||||||
import BaseComponent from '@primevue/core/basecomponent';
|
import BaseInput from '@primevue/core/baseinput';
|
||||||
import InputOtpStyle from 'primevue/inputotp/style';
|
import InputOtpStyle from 'primevue/inputotp/style';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'BaseInputOtp',
|
name: 'BaseInputOtp',
|
||||||
extends: BaseComponent,
|
extends: BaseInput,
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
|
||||||
type: null,
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
invalid: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
disabled: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
readonly: {
|
readonly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
variant: {
|
|
||||||
type: String,
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
tabindex: {
|
tabindex: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null
|
default: null
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
:value="tokens[i - 1]"
|
:value="tokens[i - 1]"
|
||||||
:type="inputType"
|
:type="inputType"
|
||||||
:class="cx('pcInputText')"
|
:class="cx('pcInputText')"
|
||||||
|
:name="$formName"
|
||||||
:inputmode="inputMode"
|
:inputmode="inputMode"
|
||||||
:variant="variant"
|
:variant="variant"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
@ -34,7 +35,7 @@ export default {
|
||||||
name: 'InputOtp',
|
name: 'InputOtp',
|
||||||
extends: BaseInputOtp,
|
extends: BaseInputOtp,
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
emits: ['update:modelValue', 'change', 'focus', 'blur'],
|
emits: ['change', 'focus', 'blur'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tokens: []
|
tokens: []
|
||||||
|
@ -76,7 +77,7 @@ export default {
|
||||||
updateModel(event) {
|
updateModel(event) {
|
||||||
const newValue = this.tokens.join('');
|
const newValue = this.tokens.join('');
|
||||||
|
|
||||||
this.$emit('update:modelValue', newValue);
|
this.updateValue(newValue, event);
|
||||||
this.$emit('change', {
|
this.$emit('change', {
|
||||||
originalEvent: event,
|
originalEvent: event,
|
||||||
value: newValue
|
value: newValue
|
||||||
|
|
Loading…
Reference in New Issue