Skip to content

Commit

Permalink
fix: duplicate value when input from right and using 'v-model'
Browse files Browse the repository at this point in the history
  • Loading branch information
lushuo committed Feb 29, 2024
1 parent 71cd390 commit bf6459e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/vue3-otp-input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,11 @@ export default /* #__PURE__ */ defineComponent({
watch(
() => props.value,
(val) => {
const fill = unref(val).split("");
otp.value = fill;
// fix issue: https://github.com/ejirocodes/vue3-otp-input/issues/34
if (val.length === props.numInputs || otp.value.length === 0) {
const fill = unref(val).split('')
otp.value = fill
}
},
{ immediate: true }
);
Expand Down

0 comments on commit bf6459e

Please sign in to comment.