Skip to content

Commit

Permalink
Merge pull request #42 from lu-shuo/fix-duplicating-input
Browse files Browse the repository at this point in the history
fix: duplicate value when input from right and using 'v-model'
  • Loading branch information
ejirocodes authored Feb 29, 2024
2 parents 163eb39 + bf6459e commit 957d182
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 @@ -84,8 +84,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 957d182

Please sign in to comment.